summaryrefslogtreecommitdiffstats
path: root/tests/auto/mediaobject
diff options
context:
space:
mode:
authorFrans Englich <frans.englich@nokia.com>2010-03-05 15:24:48 (GMT)
committerFrans Englich <frans.englich@nokia.com>2010-03-10 13:04:39 (GMT)
commit64cd7dea0e2f3d6544e6cc47ccd857b1ce3d44e7 (patch)
tree624e132fcc043678e5763bf4f1492d9f34d57eac /tests/auto/mediaobject
parent24392fb62bb34a80eb7ce13662b0a8744c9ab415 (diff)
downloadQt-64cd7dea0e2f3d6544e6cc47ccd857b1ce3d44e7.zip
Qt-64cd7dea0e2f3d6544e6cc47ccd857b1ce3d44e7.tar.gz
Qt-64cd7dea0e2f3d6544e6cc47ccd857b1ce3d44e7.tar.bz2
Fix SDP files are not supported.
The Phonon glue code rejected SDPs based on the MIME type for SDPs. Task-number: QTBUG-8702 Reviewed-by: Gareth Stockwell
Diffstat (limited to 'tests/auto/mediaobject')
-rw-r--r--tests/auto/mediaobject/media/test.sdp32
-rwxr-xr-xtests/auto/mediaobject/mediaobject.pro6
-rw-r--r--tests/auto/mediaobject/mediaobject.qrc1
-rw-r--r--tests/auto/mediaobject/tst_mediaobject.cpp75
4 files changed, 106 insertions, 8 deletions
diff --git a/tests/auto/mediaobject/media/test.sdp b/tests/auto/mediaobject/media/test.sdp
new file mode 100644
index 0000000..0d8706c
--- /dev/null
+++ b/tests/auto/mediaobject/media/test.sdp
@@ -0,0 +1,32 @@
+v=0
+o=- 3476526279 2351211129 IN IP4 XXX.XXX.XXX.XXX
+s=SOME STRING
+e=support@localhost
+c=IN IP4 XXX.XXX.XXX.XXX
+t=0 0
+a=range:npt=now-
+a=random_access_denied
+a=control:rtsp://link
+m=video 0 RTP/AVP 96
+b=AS:100
+b=RR:2500
+b=RS:2500
+a=control:rtsp://link
+a=rtpmap:96 MP4V-ES/90000
+a=3GPP-Adaptation-Support:1
+a=cliprect:0,0,144,176
+a=mpeg4-esid:201
+a=x-envivio-verid:00022B15
+a=fmtp:96 profile-level-id=2;config=000001b002000001b50ea020202f000001000000012000c788ba9850584121463f
+a=framerate:15.0
+m=audio 0 RTP/AVP 97
+b=AS:14
+b=RR:350
+b=RS:350
+a=control:rtsp://link
+a=rtpmap:97 AMR/8000
+a=3GPP-Adaptation-Support:1
+a=mpeg4-esid:101
+a=x-envivio-verid:00022B15
+a=fmtp:97 octet-align=1
+a=maxptime:200
diff --git a/tests/auto/mediaobject/mediaobject.pro b/tests/auto/mediaobject/mediaobject.pro
index 5d4a098..bef2fe9 100755
--- a/tests/auto/mediaobject/mediaobject.pro
+++ b/tests/auto/mediaobject/mediaobject.pro
@@ -14,3 +14,9 @@ wince*{
DEFINES += tst_MediaObject=tst_MediaObject_waveout
}
+symbian*:{
+ addFiles.sources = media/test.sdp
+ addFiles.path = media
+ DEPLOYMENT += addFiles
+}
+
diff --git a/tests/auto/mediaobject/mediaobject.qrc b/tests/auto/mediaobject/mediaobject.qrc
index 4f46213..77954f4 100644
--- a/tests/auto/mediaobject/mediaobject.qrc
+++ b/tests/auto/mediaobject/mediaobject.qrc
@@ -3,5 +3,6 @@
<file>media/sax.wav</file>
<file>media/sax.ogg</file>
<file>media/sax.mp3</file>
+<file>media/test.sdp</file>
</qresource>
</RCC>
diff --git a/tests/auto/mediaobject/tst_mediaobject.cpp b/tests/auto/mediaobject/tst_mediaobject.cpp
index 16b2611..4cb08fb 100644
--- a/tests/auto/mediaobject/tst_mediaobject.cpp
+++ b/tests/auto/mediaobject/tst_mediaobject.cpp
@@ -139,6 +139,7 @@ class tst_MediaObject : public QObject
void pauseToPause();
void pauseToPlay();
void pauseToStop();
+ void playSDP();
void testPrefinishMark();
void testSeek();
@@ -160,6 +161,11 @@ class tst_MediaObject : public QObject
Phonon::MediaObject *m_media;
QSignalSpy *m_stateChangedSignalSpy;
QString m_tmpFileName;
+
+ static void copyMediaFile(const QString &original,
+ const QString &name,
+ QString &resultFilePath,
+ QUrl *const asURL = 0);
#endif //QT_NO_PHONON
bool m_success;
};
@@ -352,6 +358,24 @@ void tst_MediaObject::_pausePlayback()
m_success = true;
}
+/*!
+ Copies the file \a name to the testing area. The resulting file name path is
+ returned in resultFilePath, and also set as a URL in \a asURL.
+ */
+void tst_MediaObject::copyMediaFile(const QString &original,
+ const QString &name,
+ QString &resultFilePath,
+ QUrl *const asURL)
+{
+ resultFilePath = QDir::toNativeSeparators(QDir::tempPath() + name);
+ if (asURL)
+ *asURL = QUrl::fromLocalFile(resultFilePath);
+
+ QFile::remove(resultFilePath);
+ QVERIFY(QFile::copy(original, resultFilePath));
+ QFile::setPermissions(resultFilePath, QFile::permissions(resultFilePath) | QFile::WriteOther);
+}
+
void tst_MediaObject::initTestCase()
{
QCoreApplication::setApplicationName("tst_MediaObject");
@@ -375,14 +399,8 @@ void tst_MediaObject::initTestCase()
QVERIFY(m_stateChangedSignalSpy->isValid());
m_stateChangedSignalSpy->clear();
- if (m_url.isEmpty()) {
- m_tmpFileName = QDir::toNativeSeparators(QDir::tempPath() + MEDIA_FILE);
- QFile::remove(m_tmpFileName);
- QVERIFY(QFile::copy(MEDIA_FILEPATH, m_tmpFileName));
- QFile::Permissions p = QFile::permissions(m_tmpFileName);
- QFile::setPermissions(m_tmpFileName, p | QFile::WriteOther);
- m_url = QUrl::fromLocalFile(m_tmpFileName);
- }
+ if (m_url.isEmpty())
+ copyMediaFile(MEDIA_FILEPATH, MEDIA_FILE, m_tmpFileName, &m_url);
qDebug() << "Using url:" << m_url.toString();
@@ -533,6 +551,47 @@ void tst_MediaObject::pauseToStop()
stopPlayback(Phonon::PausedState);
}
+/*!
+
+ We attempt to play a SDP file. An SDP file essentially describes different
+ media streams and is hence a layer in front of the actual media(s).
+ Sometimes the backend handles the SDP file, in other cases not.
+
+ Some Phonon backends doesn't support SDP at all, ifdef appropriately. Real
+ Player and Helix, the two backends for Symbian, are known to support SDP.
+ */
+void tst_MediaObject::playSDP()
+{
+#ifdef Q_OS_SYMBIAN
+ QString sdpFile;
+ copyMediaFile(QLatin1String(":/media/test.sdp"), QLatin1String("test.sdp"), sdpFile);
+
+ // Let's verify our test setup.
+ QVERIFY(QFileInfo(sdpFile).isReadable());
+
+ // We need a window in order to setup the video.
+ QWidget widget;
+ widget.show();
+
+ const MediaSource oldSource(m_media->currentSource());
+ const MediaSource sdpSource(sdpFile);
+ m_media->setCurrentSource(sdpSource);
+ if (m_media->state() != Phonon::StoppedState)
+ QTest::waitForSignal(m_media, SIGNAL(stateChanged(Phonon::State, Phonon::State)), 10000);
+
+ // At this point we're in error state due to absent media, but it has now loaded the SDP:
+ QCOMPARE(m_media->errorString(), QString::fromLatin1("Buffering clip failed: Unknown error (-39)"));
+
+ // We cannot play the SDP, we can neither attempt to play it, because we
+ // won't get a state change from ErrorState to ErrorState, and hence block
+ // on a never occuring signal.
+ m_media->setCurrentSource(oldSource);
+
+#else
+ QSKIP("Unsupported on this platform.", SkipAll);
+#endif
+}
+
void tst_MediaObject::testPrefinishMark()
{
const qint32 requestedPrefinishMarkTime = 2000;