summaryrefslogtreecommitdiffstats
path: root/tests/auto/xmlpatternsxqts/Baseline.xml
Commit message (Expand)AuthorAgeFilesLines
* Update obsolete email addresses.Jason McDonald2009-08-121-1/+1
* Long live Qt!Lars Knoll2009-03-231-0/+2
4.2%;'/> -rw-r--r--src/multimedia/base/qmediaserviceprovider.cpp43
-rw-r--r--src/multimedia/base/qmediaserviceprovider.h3
-rw-r--r--src/multimedia/effects/wavedecoder_p.cpp21
-rw-r--r--src/multimedia/effects/wavedecoder_p.h1
-rw-r--r--src/multimedia/playback/qmediaplayer.cpp36
-rw-r--r--src/multimedia/playback/qmediaplayer.h3
-rw-r--r--tests/auto/qmediaserviceprovider/tst_qmediaserviceprovider.cpp72
9 files changed, 188 insertions, 22 deletions
diff --git a/demos/multimedia/player/player.cpp b/demos/multimedia/player/player.cpp
index 49d18cb..af30a97 100644
--- a/demos/multimedia/player/player.cpp
+++ b/demos/multimedia/player/player.cpp
@@ -81,6 +81,22 @@ Player::Player(QWidget *parent)
connect(playlistView, SIGNAL(activated(QModelIndex)), this, SLOT(jump(QModelIndex)));
+ playbackModeBox = new QComboBox;
+ playbackModeBox->addItem(tr("Linear"),
+ QVariant::fromValue<QMediaPlaylist::PlaybackMode>(QMediaPlaylist::Linear));
+ playbackModeBox->addItem(tr("Loop"),
+ QVariant::fromValue<QMediaPlaylist::PlaybackMode>(QMediaPlaylist::Loop));
+ playbackModeBox->addItem(tr("Random"),
+ QVariant::fromValue<QMediaPlaylist::PlaybackMode>(QMediaPlaylist::Random));
+ playbackModeBox->addItem(tr("Current Item Once"),
+ QVariant::fromValue<QMediaPlaylist::PlaybackMode>(QMediaPlaylist::CurrentItemOnce));
+ playbackModeBox->addItem(tr("Current Item In Loop"),
+ QVariant::fromValue<QMediaPlaylist::PlaybackMode>(QMediaPlaylist::CurrentItemInLoop));
+ playbackModeBox->setCurrentIndex(0);
+
+ connect(playbackModeBox, SIGNAL(activated(int)), SLOT(updatePlaybackMode()));
+ updatePlaybackMode();
+
slider = new QSlider(Qt::Horizontal);
slider->setRange(0, player->duration() / 1000);
@@ -126,12 +142,16 @@ Player::Player(QWidget *parent)
else
colorButton->setEnabled(false);
+ QBoxLayout *playlistLayout = new QVBoxLayout;
+ playlistLayout->addWidget(playlistView);
+ playlistLayout->addWidget(playbackModeBox);
+
QBoxLayout *displayLayout = new QHBoxLayout;
if (videoWidget)
displayLayout->addWidget(videoWidget, 2);
else
displayLayout->addWidget(coverLabel, 2);
- displayLayout->addWidget(playlistView);
+ displayLayout->addLayout(playlistLayout);
QBoxLayout *controlLayout = new QHBoxLayout;
controlLayout->setMargin(0);
@@ -333,3 +353,9 @@ void Player::showColorDialog()
}
colorDialog->show();
}
+
+void Player::updatePlaybackMode()
+{
+ playlist->setPlaybackMode(
+ playbackModeBox->itemData(playbackModeBox->currentIndex()).value<QMediaPlaylist::PlaybackMode>());
+}
diff --git a/demos/multimedia/player/player.h b/demos/multimedia/player/player.h
index 1de8b1a..cda3eb9 100644
--- a/demos/multimedia/player/player.h
+++ b/demos/multimedia/player/player.h
@@ -57,6 +57,7 @@ class QAbstractItemView;
class QLabel;
class QModelIndex;
class QSlider;
+class QComboBox;
class QMediaPlayer;
class QVideoWidget;
class PlaylistModel;
@@ -87,6 +88,7 @@ private slots:
void bufferingProgress(int progress);
void showColorDialog();
+ void updatePlaybackMode();
private:
void setTrackInfo(const QString &info);
@@ -97,6 +99,7 @@ private:
QVideoWidget *videoWidget;
QLabel *coverLabel;
QSlider *slider;
+ QComboBox *playbackModeBox;
PlaylistModel *playlistModel;
QAbstractItemView *playlistView;
QDialog *colorDialog;
diff --git a/src/multimedia/base/qmediaserviceprovider.cpp b/src/multimedia/base/qmediaserviceprovider.cpp
index d51d682..6e11079 100644
--- a/src/multimedia/base/qmediaserviceprovider.cpp
+++ b/src/multimedia/base/qmediaserviceprovider.cpp
@@ -102,6 +102,9 @@ public:
\value RecordingSupport
The service provides audio or video recording functions.
+
+ \value StreamPlayback
+ The service is capable of playing QIODevice based streams.
*/
/*!
@@ -396,14 +399,25 @@ public:
QMediaServiceSupportedFormatsInterface *iface =
qobject_cast<QMediaServiceSupportedFormatsInterface*>(obj);
- //if low latency playback was asked, skip services known
- //not to provide low latency playback
- if (flags & QMediaPlayer::LowLatency) {
+
+ if (flags) {
QMediaServiceFeaturesInterface *iface =
qobject_cast<QMediaServiceFeaturesInterface*>(obj);
- if (iface && !(iface->supportedFeatures(serviceType) & QMediaServiceProviderHint::LowLatencyPlayback))
- continue;
+ if (iface) {
+ QMediaServiceProviderHint::Features features = iface->supportedFeatures(serviceType);
+
+ //if low latency playback was asked, skip services known
+ //not to provide low latency playback
+ if ((flags & QMediaPlayer::LowLatency) &&
+ !(features & QMediaServiceProviderHint::LowLatencyPlayback))
+ continue;
+
+ //the same for QIODevice based streams support
+ if ((flags & QMediaPlayer::StreamPlayback) &&
+ !(features & QMediaServiceProviderHint::StreamPlayback))
+ continue;
+ }
}
if (iface)
@@ -434,14 +448,25 @@ public:
QMediaServiceSupportedFormatsInterface *iface =
qobject_cast<QMediaServiceSupportedFormatsInterface*>(obj);
- // If low latency playback was asked for, skip MIME types from services known
- // not to provide low latency playback
+
if (flags & QMediaPlayer::LowLatency) {
QMediaServiceFeaturesInterface *iface =
qobject_cast<QMediaServiceFeaturesInterface*>(obj);
- if (iface && !(iface->supportedFeatures(serviceType) & QMediaServiceProviderHint::LowLatencyPlayback))
- continue;
+ if (iface) {
+ QMediaServiceProviderHint::Features features = iface->supportedFeatures(serviceType);
+
+ // If low latency playback was asked for, skip MIME types from services known
+ // not to provide low latency playback
+ if ((flags & QMediaPlayer::LowLatency) &&
+ !(features & QMediaServiceProviderHint::LowLatencyPlayback))
+ continue;
+
+ //the same for QIODevice based streams support
+ if ((flags & QMediaPlayer::StreamPlayback) &&
+ !(features & QMediaServiceProviderHint::StreamPlayback))
+ continue;
+ }
}
if (iface) {
diff --git a/src/multimedia/base/qmediaserviceprovider.h b/src/multimedia/base/qmediaserviceprovider.h
index 2ee0ae4..6e31493 100644
--- a/src/multimedia/base/qmediaserviceprovider.h
+++ b/src/multimedia/base/qmediaserviceprovider.h
@@ -64,7 +64,8 @@ public:
enum Feature {
LowLatencyPlayback = 0x01,
- RecordingSupport = 0x02
+ RecordingSupport = 0x02,
+ StreamPlayback = 0x04
};
Q_DECLARE_FLAGS(Features, Feature)
diff --git a/src/multimedia/effects/wavedecoder_p.cpp b/src/multimedia/effects/wavedecoder_p.cpp
index f2277ae..b534ded 100644
--- a/src/multimedia/effects/wavedecoder_p.cpp
+++ b/src/multimedia/effects/wavedecoder_p.cpp
@@ -55,7 +55,7 @@ WaveDecoder::WaveDecoder(QIODevice *s, QObject *parent):
{
open(QIODevice::ReadOnly | QIODevice::Unbuffered);
- if (source->bytesAvailable() >= sizeof(CombinedHeader))
+ if (source->bytesAvailable() >= qint64(sizeof(CombinedHeader) + sizeof(DATAHeader) + sizeof(quint16)))
QTimer::singleShot(0, this, SLOT(handleData()));
else
connect(source, SIGNAL(readyRead()), SLOT(handleData()));
@@ -105,7 +105,7 @@ qint64 WaveDecoder::writeData(const char *data, qint64 len)
void WaveDecoder::handleData()
{
- if (source->bytesAvailable() < sizeof(CombinedHeader))
+ if (source->bytesAvailable() < qint64(sizeof(CombinedHeader) + sizeof(DATAHeader) + sizeof(quint16)))
return;
source->disconnect(SIGNAL(readyRead()), this, SLOT(handleData()));
@@ -114,12 +114,23 @@ void WaveDecoder::handleData()
if (qstrncmp(header.riff.descriptor.id, "RIFF", 4) != 0 ||
qstrncmp(header.riff.type, "WAVE", 4) != 0 ||
qstrncmp(header.wave.descriptor.id, "fmt ", 4) != 0 ||
- (header.wave.audioFormat != 0 && header.wave.audioFormat != 1) ||
- qstrncmp(header.data.descriptor.id, "data", 4) != 0) {
+ (header.wave.audioFormat != 0 && header.wave.audioFormat != 1)) {
emit invalidFormat();
}
else {
+ DATAHeader dataHeader;
+
+ if (qFromLittleEndian<quint32>(header.wave.descriptor.size) > sizeof(WAVEHeader)) {
+ // Extended data available
+ quint16 extraFormatBytes;
+ source->peek((char*)&extraFormatBytes, sizeof(quint16));
+ extraFormatBytes = qFromLittleEndian<quint16>(extraFormatBytes);
+ source->read(sizeof(quint16) + extraFormatBytes); // dump it all
+ }
+
+ source->read((char*)&dataHeader, sizeof(DATAHeader));
+
int bps = qFromLittleEndian<quint16>(header.wave.bitsPerSample);
format.setCodec(QLatin1String("audio/pcm"));
@@ -129,7 +140,7 @@ void WaveDecoder::handleData()
format.setSampleSize(bps);
format.setChannels(qFromLittleEndian<quint16>(header.wave.numChannels));
- dataSize = qFromLittleEndian<quint32>(header.data.descriptor.size);
+ dataSize = qFromLittleEndian<quint32>(dataHeader.descriptor.size);
haveFormat = true;
connect(source, SIGNAL(readyRead()), SIGNAL(readyRead()));
diff --git a/src/multimedia/effects/wavedecoder_p.h b/src/multimedia/effects/wavedecoder_p.h
index 00aa14e..fa1f77e 100644
--- a/src/multimedia/effects/wavedecoder_p.h
+++ b/src/multimedia/effects/wavedecoder_p.h
@@ -116,7 +116,6 @@ private:
{
RIFFHeader riff;
WAVEHeader wave;
- DATAHeader data;
};
bool haveFormat;
diff --git a/src/multimedia/playback/qmediaplayer.cpp b/src/multimedia/playback/qmediaplayer.cpp