Merge remote-tracking branch 'origin/stable' into dev

Change-Id: I0f0457e9863f540b7bd8bc104c92891d8cf5c483
This commit is contained in:
Frederik Gladhorn
2013-04-29 14:19:29 +02:00
19 changed files with 147 additions and 128 deletions

View File

@@ -172,9 +172,6 @@ void AudioRecorder::toggleRecord()
if (audioRecorder->state() == QMediaRecorder::StoppedState) { if (audioRecorder->state() == QMediaRecorder::StoppedState) {
audioRecorder->setAudioInput(boxValue(ui->audioDeviceBox).toString()); audioRecorder->setAudioInput(boxValue(ui->audioDeviceBox).toString());
if (!outputLocationSet)
audioRecorder->setOutputLocation(generateAudioFilePath());
QAudioEncoderSettings settings; QAudioEncoderSettings settings;
settings.setCodec(boxValue(ui->audioCodecBox).toString()); settings.setCodec(boxValue(ui->audioCodecBox).toString());
settings.setSampleRate(boxValue(ui->sampleRateBox).toInt()); settings.setSampleRate(boxValue(ui->sampleRateBox).toInt());
@@ -214,24 +211,6 @@ void AudioRecorder::displayErrorMessage()
ui->statusbar->showMessage(audioRecorder->errorString()); ui->statusbar->showMessage(audioRecorder->errorString());
} }
QUrl AudioRecorder::generateAudioFilePath()
{
QDir outputDir(QDir::rootPath());
int lastImage = 0;
int fileCount = 0;
foreach (const QString &fileName, outputDir.entryList(QStringList(QString("testclip_*")))) {
int imgNumber = fileName.mid(5, fileName.size() - 9).toInt();
lastImage = qMax(lastImage, imgNumber);
if (outputDir.exists(fileName))
fileCount += 1;
}
lastImage += fileCount;
QUrl location(QDir::toNativeSeparators(outputDir.canonicalPath()
+ QString("/testclip_%1").arg(lastImage + 1, 4, 10, QLatin1Char('0'))));
return location;
}
// This function returns the maximum possible sample value for a given audio format // This function returns the maximum possible sample value for a given audio format
qreal getPeakValue(const QAudioFormat& format) qreal getPeakValue(const QAudioFormat& format)
{ {

View File

@@ -71,7 +71,6 @@ private slots:
void updateState(QMediaRecorder::State); void updateState(QMediaRecorder::State);
void updateProgress(qint64 pos); void updateProgress(qint64 pos);
void displayErrorMessage(); void displayErrorMessage();
QUrl generateAudioFilePath();
private: private:
Ui::AudioRecorder *ui; Ui::AudioRecorder *ui;

View File

@@ -90,7 +90,7 @@ void QGstreamerVideoRenderer::setSurface(QAbstractVideoSurface *surface)
m_videoSink = 0; m_videoSink = 0;
if (m_surface) { if (m_surface) {
disconnect(m_surface, SIGNAL(supportedFormatsChanged()), disconnect(m_surface.data(), SIGNAL(supportedFormatsChanged()),
this, SLOT(handleFormatChange())); this, SLOT(handleFormatChange()));
} }
@@ -99,7 +99,7 @@ void QGstreamerVideoRenderer::setSurface(QAbstractVideoSurface *surface)
m_surface = surface; m_surface = surface;
if (m_surface) { if (m_surface) {
connect(m_surface, SIGNAL(supportedFormatsChanged()), connect(m_surface.data(), SIGNAL(supportedFormatsChanged()),
this, SLOT(handleFormatChange())); this, SLOT(handleFormatChange()));
} }

View File

@@ -1,7 +1,5 @@
QT += qml quick network multimedia-private qtmultimediaquicktools-private QT += qml quick network multimedia-private qtmultimediaquicktools-private
LIBS += -L$$QT.multimedia.libs
HEADERS += \ HEADERS += \
qdeclarativeaudio_p.h \ qdeclarativeaudio_p.h \
qdeclarativemediametadata_p.h \ qdeclarativemediametadata_p.h \

View File

@@ -1,6 +1,6 @@
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = qtmultimedia project = QtMultimedia
description = Qt Multimedia Documentation description = Qt Multimedia Documentation
url = http://qt-project.org/doc/qt-$QT_VER/qtmultimedia url = http://qt-project.org/doc/qt-$QT_VER/qtmultimedia
version = $QT_VERSION version = $QT_VERSION
@@ -12,22 +12,22 @@ version = $QT_VERSION
# Defines the name of the project. You cannot use operators (+, =, -) in # Defines the name of the project. You cannot use operators (+, =, -) in
# the name. Properties for this project are set using a qhp.<projectname>.property # the name. Properties for this project are set using a qhp.<projectname>.property
# format. # format.
qhp.projects = qtmultimedia qhp.projects = QtMultimedia
qhp.qtmultimedia.file = qtmultimedia.qhp qhp.QtMultimedia.file = qtmultimedia.qhp
qhp.qtmultimedia.namespace = org.qt-project.qtmultimedia.$QT_VERSION_TAG qhp.QtMultimedia.namespace = org.qt-project.qtmultimedia.$QT_VERSION_TAG
qhp.qtmultimedia.indexTitle = Qt Multimedia qhp.QtMultimedia.indexTitle = Qt Multimedia
qhp.qtmultimedia.virtualFolder = qtmultimedia qhp.QtMultimedia.virtualFolder = qtmultimedia
# For listing child nodes in Qt Creator or Assistant. # For listing child nodes in Qt Creator or Assistant.
qhp.qtmultimedia.subprojects = classes qmltypes qhp.QtMultimedia.subprojects = classes qmltypes
qhp.qtmultimedia.subprojects.classes.title = C++ Classes qhp.QtMultimedia.subprojects.classes.title = C++ Classes
qhp.qtmultimedia.subprojects.classes.indexTitle = Qt Multimedia C++ Classes qhp.QtMultimedia.subprojects.classes.indexTitle = Qt Multimedia C++ Classes
qhp.qtmultimedia.subprojects.classes.selectors = class fake:headerfile qhp.QtMultimedia.subprojects.classes.selectors = class fake:headerfile
qhp.qtmultimedia.subprojects.classes.sortPages = true qhp.QtMultimedia.subprojects.classes.sortPages = true
qhp.qtmultimedia.subprojects.qmltypes.title = QML Types qhp.QtMultimedia.subprojects.qmltypes.title = QML Types
qhp.qtmultimedia.subprojects.qmltypes.indexTitle = Qt Multimedia QML Types qhp.QtMultimedia.subprojects.qmltypes.indexTitle = Qt Multimedia QML Types
qhp.qtmultimedia.subprojects.qmltypes.selectors = fake:qmlclass qhp.QtMultimedia.subprojects.qmltypes.selectors = fake:qmlclass
qhp.qtmultimedia.subprojects.qmltypes.sortPages = true qhp.QtMultimedia.subprojects.qmltypes.sortPages = true
exampledirs += ../../../examples/multimedia \ exampledirs += ../../../examples/multimedia \
snippets snippets

View File

@@ -27,40 +27,37 @@
/*! /*!
\page multimediaoverview.html \page multimediaoverview.html
\title Qt Multimedia Overview \title Multimedia
\brief A set of APIs for working with audio, video, radio and camera devices. \brief A set of APIs for working with audio, video, radio and camera devices.
\ingroup technology-apis \ingroup technology-apis
Multimedia support in Qt is provided by the \l{Qt Multimedia} module. The Qt
Multimedia module provides a rich feature set that enables you to easily take
advantage of a platform's multimedia capabilities such as media playback and
the use of camera and radio devices.
\section1 Overview \section1 Features
Multimedia support in Qt is provided by the Qt Multimedia module. The
Qt Multimedia module provides a rich feature set that enables you to easily
take advantage of a platforms multimedia capabilites and hardware. This
ranges from the playback and recording of audio and video content to the use
of available devices like cameras and radios.
\section2 Features
Here are some examples of what can be done with Qt Multimedia APIs: Here are some examples of what can be done with Qt Multimedia APIs:
\list \list
\li Access raw audio devices for input and output \li Access raw audio devices for input and output
\li Play low latency sound effects \li Play low latency sound effects
\li Play media files in playlists (like compressed audio, or video files) \li Play media files in playlists (such as compressed audio or video files)
\li Record audio and compress it \li Record audio and compress it
\li Tune and listen to radio stations, and receive radio program information \li Tune and listen to radio stations
\li Use a camera, including viewfinder, image capture, and movie recording \li Use a camera, including viewfinder, image capture, and movie recording
\li Play 3D positional audio with \l {Positional Audio} {QtAudioEngine} \li Play 3D positional audio with \l {Positional Audio} {QtAudioEngine}
\li Decode audio media files into memory for processing \li Decode audio media files into memory for processing
\li Accessing video frames or audio buffers as they are played or recorded \li Accessing video frames or audio buffers as they are played or recorded
\endlist \endlist
\section2 Multimedia Components \section1 Multimedia Components
All of these tasks can be broadly broken down into four main areas. More information Qt's multimedia APIs are categorized into four main components. More
(including background information and class references) are available here: information (including background information and class references) is
available here:
\list \list
\li \l {Audio Overview} \li \l {Audio Overview}
@@ -69,8 +66,9 @@ All of these tasks can be broadly broken down into four main areas. More inform
\li \l {Radio Overview} \li \l {Radio Overview}
\endlist \endlist
\section2 Multimedia Recipes \section1 Multimedia Recipes
For some quick recipes for specific tasks, look at the overviews above and consult this table:
For some quick recipes, look at the overviews above and consult this table:
\table 70% \table 70%
\header \header
@@ -85,7 +83,8 @@ For some quick recipes for specific tasks, look at the overviews above and consu
\li QSoundEffect \li QSoundEffect
\row \row
\li Playing low latency audio \li Playing low latency audio
\li \l{multimedia/audiooutput}{audioinput}, \l{multimedia/spectrum}{spectrum} \li \l{multimedia/audiooutput}{audioinput},
\l{multimedia/spectrum}{spectrum}
\li \li
\li QAudioOutput \li QAudioOutput
\row \row
@@ -95,7 +94,8 @@ For some quick recipes for specific tasks, look at the overviews above and consu
\li QMediaPlayer \li QMediaPlayer
\row \row
\li Accessing raw audio input data \li Accessing raw audio input data
\li \l{multimedia/spectrum}{spectrum}, \l {multimedia/audioinput}{audioinput} \li \l{multimedia/spectrum}{spectrum},
\l {multimedia/audioinput}{audioinput}
\li \li
\li QAudioInput \li QAudioInput
\row \row
@@ -138,12 +138,14 @@ For some quick recipes for specific tasks, look at the overviews above and consu
\li QCamera, QAbstractVideoSurface, QVideoFrame \li QCamera, QAbstractVideoSurface, QVideoFrame
\row \row
\li Capturing photos \li Capturing photos
\li \l {Camera Example}{camera}, \l {multimediawidgets/declarative-camera}{declarative-camera} \li \l {Camera Example}{camera},
\l {multimediawidgets/declarative-camera}{declarative-camera}
\li \l Camera \li \l Camera
\li QCamera, QCameraImageCapture \li QCamera, QCameraImageCapture
\row \row
\li Capturing movies \li Capturing movies
\li \l {Camera Example}{camera}, \l {multimediawidgets/declarative-camera}{declarative-camera} \li \l {Camera Example}{camera},
\l {multimediawidgets/declarative-camera}{declarative-camera}
\li \l Camera \li \l Camera
\li QCamera, QMediaRecorder \li QCamera, QMediaRecorder
\row \row
@@ -156,26 +158,26 @@ For some quick recipes for specific tasks, look at the overviews above and consu
\section1 Limitations \section1 Limitations
In many cases the Qt Multimedia APIs build upon the multimedia framework of the underlying system. The Qt Multimedia APIs build upon the multimedia framework of the underlying
This can mean that support for various codec or containers can vary between machines, platform. This can mean that support for various codecs or containers can vary
depending on what the end user has installed. between machines, depending on what the end user has installed.
\section1 Advanced Usage \section1 Advanced Usage
For developers wishing to access some platform specific settings, For developers wishing to access some platform specific settings, or to port the
or to port the Qt Multimedia APIs to a new platform or technology, Qt Multimedia APIs to a new platform or technology, see \l{Multimedia Backend
see \l{Multimedia Backend Development}. Development}.
\section1 Changes from Previous Versions \section1 Changes from Previous Versions
If you've previously used Qt Multimedia in Qt 4.x, or used Qt Multimedia Kit in Qt Mobility, please see If you previously used Qt Multimedia in Qt 4, or used Qt Multimedia Kit in
\l {Changes in Qt Multimedia} for more information on what has changed, and what you might need to Qt Mobility, please see \l {Changes in Qt Multimedia} for more information on
change when porting code. what changed, and what you might need to change when porting code.
\section1 Reference Documentation \section1 Reference Documentation
\section2 QML Types \section2 QML Types
The following types are accessed by using: The QML types are accessed by using:
\code \code
import QtMultimedia 5.0 import QtMultimedia 5.0
\endcode \endcode

View File

@@ -30,10 +30,12 @@
\title Qt Multimedia C++ Classes \title Qt Multimedia C++ Classes
\ingroup modules \ingroup modules
\brief The \l {Qt Multimedia} module provides audio, video, radio and camera functionality. \brief The \l {Qt Multimedia} module provides audio, video, radio and camera
functionality.
The C++ classes provide more control over the multimedia content than the QML alternatives. The C++ classes provide more control over the multimedia content than the
If your application is serving complex use cases such as decoding media files, accessing video or audio buffers, QML alternatives. If your application is serving complex use cases such as
use the C++ alternative. For more details about the complex audio, video, and camera use cases supported by the C++ decoding media files, accessing video or audio buffers, use the C++
classes, refer to \l {Qt Multimedia Overview}. alternative. For more details about the complex audio, video, and camera use
cases supported by the C++ classes, refer to \l {Qt Multimedia Overview}.
*/ */

View File

@@ -28,37 +28,46 @@
/*! /*!
\page qtmultimedia-index.html \page qtmultimedia-index.html
\title Qt Multimedia \title Qt Multimedia
\brief The Qt Multimedia module provides APIs for audio, video, radio and camera-related functionality. \brief The Qt Multimedia module provides APIs for audio, video, radio, and
camera-related functionality.
Qt Multimedia is an essential module that provides a rich set of QML types and C++ classes to handle multimedia content. It also provides necessary APIs to access the camera and radio functionality. Qt Multimedia is an essential module that provides a rich set of QML types
and C++ classes to handle multimedia content. It also provides necessary
APIs to access the camera and radio functionality.
The \l{Qt Multimedia Widgets} module provides widget based multimedia classes. The \l{Qt Multimedia Widgets} module provides widget based multimedia
classes.
\section1 Getting started \section1 Getting Started
The QML types can be imported into your applciation using the following import statement in your \c {.qml} file. The QML types can be imported into your applciation using the following
import statement in your \c {.qml} file.
\code \code
import QtMultimedia 5.0 import QtMultimedia 5.0
\endcode \endcode
If you intend to use the C++ classes in your application, include the C++ definitions using the following directive: If you intend to use the C++ classes in your application, include the C++
definitions using the following directive:
\code \code
#include <QtMultimedia> #include <QtMultimedia>
\endcode \endcode
\note If you are using a few classes from this module, we recommend including those specific classes only instead of the module. \note If you are using a few classes from this module, we recommend
including those specific classes only instead of the module.
To link against the corresponding C++ libraries, add the following to your \c {qmake} project file: To link against the corresponding C++ libraries, add the following to your
\c {qmake} project file:
\code \code
QT += multimedia QT += multimedia
\endcode \endcode
\section1 QML types and C++ classes \section1 QML Types and C++ Classes
The following is a list of important QML types and C++ classes provided by this module: The following is a list of important QML types and C++ classes provided by
this module:
\table \table
\header \header
@@ -72,13 +81,15 @@
\li Access camera viewfinder frames \li Access camera viewfinder frames
\row \row
\li MediaPlayer \li MediaPlayer
\li Add media playback functionality to a scene. It is same as Audio type, but can be used for video playback with the VideoOutput type. \li Add media playback functionality to a scene. It is same as Audio type,
but can be used for video playback with the VideoOutput type.
\row \row
\li \l {QtMultimedia5::Radio}{Radio} \li \l {QtMultimedia5::Radio}{Radio}
\li Access radio functionality \li Access radio functionality
\row \row
\li \l {QtMultimedia5::Video}{Video} \li \l {QtMultimedia5::Video}{Video}
\li Add Video playback functionality to a scene. It uses MediaPlayer and VideoOutput types to provide video playback functionality. \li Add Video playback functionality to a scene. It uses MediaPlayer and
VideoOutput types to provide video playback functionality.
\endtable \endtable
\table \table
@@ -105,11 +116,11 @@
\li Control video data. \li Control video data.
\endtable \endtable
\section1 Related information \section1 Related Information
\section2 Guides \section2 Guides
\list \list
\li \l{Qt Multimedia Overview} \li \l Multimedia - overview of multimedia support in Qt
\li \l{Audio Overview} \li \l{Audio Overview}
\li \l{Positional Audio} \li \l{Positional Audio}
\li \l{Video Overview} \li \l{Video Overview}

View File

@@ -44,6 +44,7 @@
#include <qvideorenderercontrol.h> #include <qvideorenderercontrol.h>
#include <private/qvideosurfacegstsink_p.h> #include <private/qvideosurfacegstsink_p.h>
#include <qabstractvideosurface.h>
#include "qgstreamervideorendererinterface_p.h" #include "qgstreamervideorendererinterface_p.h"
@@ -74,7 +75,7 @@ private slots:
private: private:
QVideoSurfaceGstSink *m_videoSink; QVideoSurfaceGstSink *m_videoSink;
QAbstractVideoSurface *m_surface; QPointer<QAbstractVideoSurface> m_surface;
}; };
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@@ -1,6 +1,6 @@
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = qtmultimediawidgets project = QtMultimediaWidgets
description = Qt Multimedia Widgets Documentation description = Qt Multimedia Widgets Documentation
url = http://qt-project.org/doc/qt-$QT_VER/qtmultimediawidgets url = http://qt-project.org/doc/qt-$QT_VER/qtmultimediawidgets
version = $QT_VERSION version = $QT_VERSION
@@ -12,22 +12,18 @@ version = $QT_VERSION
# Defines the name of the project. You cannot use operators (+, =, -) in # Defines the name of the project. You cannot use operators (+, =, -) in
# the name. Properties for this project are set using a qhp.<projectname>.property # the name. Properties for this project are set using a qhp.<projectname>.property
# format. # format.
qhp.projects = qtmultimediawidgets qhp.projects = QtMultimediaWidgets
qhp.qtmultimediawidgets.file = qtmultimediawidgets.qhp qhp.QtMultimediaWidgets.file = qtmultimediawidgets.qhp
qhp.qtmultimediawidgets.namespace = org.qt-project.qtmultimediawidgets.$QT_VERSION_TAG qhp.QtMultimediaWidgets.namespace = org.qt-project.qtmultimediawidgets.$QT_VERSION_TAG
qhp.qtmultimediawidgets.indexTitle = Qt Multimedia qhp.QtMultimediaWidgets.indexTitle = Qt Multimedia Widgets
qhp.qtmultimediawidgets.virtualFolder = qtmultimediawidgets qhp.QtMultimediaWidgets.virtualFolder = qtmultimediawidgets
# For listing child nodes in Qt Creator or Assistant. # For listing child nodes in Qt Creator or Assistant.
qhp.qtmultimediawidgets.subprojects = classes qmltypes qhp.QtMultimediaWidgets.subprojects = classes
qhp.qtmultimediawidgets.subprojects.classes.title = C++ Classes qhp.QtMultimediaWidgets.subprojects.classes.title = C++ Classes
qhp.qtmultimediawidgets.subprojects.classes.indexTitle = Qt Multimedia Widgets C++ Classes qhp.QtMultimediaWidgets.subprojects.classes.indexTitle = Qt Multimedia Widgets C++ Classes
qhp.qtmultimediawidgets.subprojects.classes.selectors = class fake:headerfile qhp.QtMultimediaWidgets.subprojects.classes.selectors = class fake:headerfile
qhp.qtmultimediawidgets.subprojects.classes.sortPages = true qhp.QtMultimediaWidgets.subprojects.classes.sortPages = true
qhp.qtmultimediawidgets.subprojects.qmltypes.title = QML Types
qhp.qtmultimediawidgets.subprojects.qmltypes.indexTitle = Qt Multimedia Widgets QML Types
qhp.qtmultimediawidgets.subprojects.qmltypes.selectors = fake:qmlclass
qhp.qtmultimediawidgets.subprojects.qmltypes.sortPages = true
exampledirs += ../../../examples/multimediawidgets \ exampledirs += ../../../examples/multimediawidgets \
snippets snippets

View File

@@ -103,6 +103,7 @@ public Q_SLOTS:
void processEOS(); void processEOS();
void processLoadStateChange(); void processLoadStateChange();
void processPositionChange(); void processPositionChange();
void processMediaLoadError();
void processCurrentItemChanged(); void processCurrentItemChanged();

View File

@@ -283,7 +283,7 @@ static void *AVFMediaPlayerSessionObserverCurrentItemObservationContext = &AVFMe
-(void) assetFailedToPrepareForPlayback:(NSError *)error -(void) assetFailedToPrepareForPlayback:(NSError *)error
{ {
Q_UNUSED(error) Q_UNUSED(error)
//TODO: Let the session know that the assest failed to prepare for playback QMetaObject::invokeMethod(m_session, "processMediaLoadError", Qt::AutoConnection);
#ifdef QT_DEBUG_AVF #ifdef QT_DEBUG_AVF
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
qDebug() << [[error localizedDescription] UTF8String]; qDebug() << [[error localizedDescription] UTF8String];
@@ -357,7 +357,7 @@ static void *AVFMediaPlayerSessionObserverCurrentItemObservationContext = &AVFMe
else if (context == AVFMediaPlayerSessionObserverCurrentItemObservationContext) else if (context == AVFMediaPlayerSessionObserverCurrentItemObservationContext)
{ {
AVPlayerItem *newPlayerItem = [change objectForKey:NSKeyValueChangeNewKey]; AVPlayerItem *newPlayerItem = [change objectForKey:NSKeyValueChangeNewKey];
if (m_playerItem != newPlayerItem); if (m_playerItem != newPlayerItem)
{ {
m_playerItem = newPlayerItem; m_playerItem = newPlayerItem;
@@ -799,13 +799,6 @@ void AVFMediaPlayerSession::processLoadStateChange()
[[(AVFMediaPlayerSessionObserver*)m_observer player] setRate:m_rate]; [[(AVFMediaPlayerSessionObserver*)m_observer player] setRate:m_rate];
[[(AVFMediaPlayerSessionObserver*)m_observer player] play]; [[(AVFMediaPlayerSessionObserver*)m_observer player] play];
} }
} else {
Q_EMIT error(QMediaPlayer::FormatError, tr("Failed to load media"));
Q_EMIT mediaStatusChanged(m_mediaStatus = QMediaPlayer::InvalidMedia);
Q_EMIT stateChanged(m_state = QMediaPlayer::StoppedState);
return;
} }
if (newStatus != m_mediaStatus) if (newStatus != m_mediaStatus)
@@ -817,6 +810,13 @@ void AVFMediaPlayerSession::processPositionChange()
Q_EMIT positionChanged(position()); Q_EMIT positionChanged(position());
} }
void AVFMediaPlayerSession::processMediaLoadError()
{
Q_EMIT error(QMediaPlayer::FormatError, tr("Failed to load media"));
Q_EMIT mediaStatusChanged(m_mediaStatus = QMediaPlayer::InvalidMedia);
Q_EMIT stateChanged(m_state = QMediaPlayer::StoppedState);
}
void AVFMediaPlayerSession::processCurrentItemChanged() void AVFMediaPlayerSession::processCurrentItemChanged()
{ {
#ifdef QT_DEBUG_AVF #ifdef QT_DEBUG_AVF

View File

@@ -40,9 +40,11 @@
****************************************************************************/ ****************************************************************************/
#include "bbserviceplugin.h" #include "bbserviceplugin.h"
#ifndef Q_OS_BLACKBERRY_TABLET
#include "bbcameraservice.h" #include "bbcameraservice.h"
#include "bbmediaplayerservice.h"
#include "bbvideodeviceselectorcontrol.h" #include "bbvideodeviceselectorcontrol.h"
#endif
#include "bbmediaplayerservice.h"
#include <QDebug> #include <QDebug>
@@ -54,8 +56,10 @@ BbServicePlugin::BbServicePlugin()
QMediaService *BbServicePlugin::create(const QString &key) QMediaService *BbServicePlugin::create(const QString &key)
{ {
#ifndef Q_OS_BLACKBERRY_TABLET
if (key == QLatin1String(Q_MEDIASERVICE_CAMERA)) if (key == QLatin1String(Q_MEDIASERVICE_CAMERA))
return new BbCameraService(); return new BbCameraService();
#endif
if (key == QLatin1String(Q_MEDIASERVICE_MEDIAPLAYER)) if (key == QLatin1String(Q_MEDIASERVICE_MEDIAPLAYER))
return new BbMediaPlayerService(); return new BbMediaPlayerService();
@@ -102,7 +106,9 @@ QString BbServicePlugin::deviceDescription(const QByteArray &service, const QByt
void BbServicePlugin::updateDevices() const void BbServicePlugin::updateDevices() const
{ {
#ifndef Q_OS_BLACKBERRY_TABLET
BbVideoDeviceSelectorControl::enumerateDevices(&m_cameraDevices, &m_cameraDescriptions); BbVideoDeviceSelectorControl::enumerateDevices(&m_cameraDevices, &m_cameraDescriptions);
#endif
if (m_cameraDevices.isEmpty()) { if (m_cameraDevices.isEmpty()) {
qWarning() << "No camera devices found"; qWarning() << "No camera devices found";

View File

@@ -11,7 +11,11 @@ HEADERS += bbserviceplugin.h
SOURCES += bbserviceplugin.cpp SOURCES += bbserviceplugin.cpp
include(common/common.pri) include(common/common.pri)
!blackberry-playbook {
include(camera/camera.pri) include(camera/camera.pri)
}
include(mediaplayer/mediaplayer.pri) include(mediaplayer/mediaplayer.pri)
OTHER_FILES += blackberry_mediaservice.json OTHER_FILES += blackberry_mediaservice.json

View File

@@ -335,7 +335,7 @@ static void imageCaptureImageCallback(camera_handle_t handle, camera_buffer_t *b
QMetaObject::invokeMethod(data->session, "imageCaptureError", Qt::QueuedConnection, QMetaObject::invokeMethod(data->session, "imageCaptureError", Qt::QueuedConnection,
Q_ARG(int, data->requestId), Q_ARG(int, data->requestId),
Q_ARG(QCameraImageCapture::Error, QCameraImageCapture::FormatError), Q_ARG(QCameraImageCapture::Error, QCameraImageCapture::FormatError),
Q_ARG(QString, QObject::tr("Camera provides image in unsupported format"))); Q_ARG(QString, BbCameraSession::tr("Camera provides image in unsupported format")));
return; return;
} }
@@ -344,7 +344,7 @@ static void imageCaptureImageCallback(camera_handle_t handle, camera_buffer_t *b
QImage image; QImage image;
const bool ok = image.loadFromData(rawData, "JPG"); const bool ok = image.loadFromData(rawData, "JPG");
if (!ok) { if (!ok) {
const QString errorMessage = QObject::tr("Could not load JPEG data from frame"); const QString errorMessage = BbCameraSession::tr("Could not load JPEG data from frame");
// We are inside a worker thread here, so emit error signal inside the main thread // We are inside a worker thread here, so emit error signal inside the main thread
QMetaObject::invokeMethod(data->session, "imageCaptureError", Qt::QueuedConnection, QMetaObject::invokeMethod(data->session, "imageCaptureError", Qt::QueuedConnection,
Q_ARG(int, data->requestId), Q_ARG(int, data->requestId),

View File

@@ -87,6 +87,30 @@ void WindowGrabber::start()
{ {
int result = 0; int result = 0;
#ifdef Q_OS_BLACKBERRY_TABLET
// HACK: On the Playbook, screen_read_window() will fail for invisible windows.
// To workaround this, make the window visible again, but set a global
// alpha of less than 255. The global alpha makes the window completely invisible
// (due to a bug?), but screen_read_window() will work again.
errno = 0;
int val = 200; // anything less than 255
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_GLOBAL_ALPHA, &val);
if (result != 0) {
qWarning() << "WindowGrabber: unable to set global alpha:" << strerror(errno);
return;
}
errno = 0;
val = 1;
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_VISIBLE, &val);
if (result != 0) {
qWarning() << "WindowGrabber: unable to make window visible:" << strerror(errno);
return;
}
#endif
result = screen_create_context(&m_screenContext, SCREEN_APPLICATION_CONTEXT); result = screen_create_context(&m_screenContext, SCREEN_APPLICATION_CONTEXT);
if (result != 0) { if (result != 0) {
qWarning() << "WindowGrabber: cannot create screen context:" << strerror(errno); qWarning() << "WindowGrabber: cannot create screen context:" << strerror(errno);

View File

@@ -672,7 +672,7 @@ void CameraBinSession::updateBusyStatus(GObject *o, GParamSpec *p, gpointer d)
Q_UNUSED(p); Q_UNUSED(p);
CameraBinSession *session = reinterpret_cast<CameraBinSession *>(d); CameraBinSession *session = reinterpret_cast<CameraBinSession *>(d);
bool idle = false; gboolean idle = false;
g_object_get(o, "idle", &idle, NULL); g_object_get(o, "idle", &idle, NULL);
bool busy = !idle; bool busy = !idle;

View File

@@ -3,9 +3,8 @@ QT += multimedia-private
CONFIG += no_private_qt_headers_warning CONFIG += no_private_qt_headers_warning
PLUGIN_TYPE = audio PLUGIN_TYPE = audio
load(qt_plugin) load(qt_plugin)
DESTDIR = $$QT.multimedia.plugins/$${PLUGIN_TYPE}
LIBS += -lasound LIBS += -lasound
HEADERS += qnxaudioplugin.h \ HEADERS += qnxaudioplugin.h \
@@ -21,6 +20,3 @@ SOURCES += qnxaudioplugin.cpp \
qnxaudioutils.cpp qnxaudioutils.cpp
OTHER_FILES += qnx_audio.json OTHER_FILES += qnx_audio.json
target.path += $$[QT_INSTALL_PLUGINS]/$${PLUGIN_TYPE}
INSTALLS += target

View File

@@ -767,9 +767,9 @@ void tst_QAudioInput::pushSuspendResume()
QVERIFY(audioInput.processedUSecs() == processedUs); QVERIFY(audioInput.processedUSecs() == processedUs);
// Drain any data, in case we run out of space when resuming // Drain any data, in case we run out of space when resuming
while (audioInput.bytesReady() >= audioInput.periodSize()) { const int reads = audioInput.bytesReady() / audioInput.periodSize();
for (int r = 0; r < reads; ++r)
feed->read(buffer.data(), audioInput.periodSize()); feed->read(buffer.data(), audioInput.periodSize());
}
audioInput.resume(); audioInput.resume();