本文整理汇总了C++中MediaSource::discType方法的典型用法代码示例。如果您正苦于以下问题:C++ MediaSource::discType方法的具体用法?C++ MediaSource::discType怎么用?C++ MediaSource::discType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MediaSource
的用法示例。
在下文中一共展示了MediaSource::discType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testIODevice
void MediaSourceTest::testIODevice()
{
const QByteArray data("0192380");
QBuffer *buffer = new QBuffer;
buffer->setData(data);
buffer->open(QIODevice::ReadOnly);
MediaSource a(buffer);
QCOMPARE(a.type(), MediaSource::Stream);
QCOMPARE(a.fileName(), QString());
QCOMPARE(a.url(), QUrl());
QCOMPARE(a.discType(), Phonon::NoDisc);
QVERIFY(a.stream() != 0);
QCOMPARE(a.deviceName(), QString());
//QCOMPARE(a.audioCaptureDevice(), AudioCaptureDevice());
//QCOMPARE(a.videoCaptureDevice(), VideoCaptureDevice());
MediaSource b(a);
MediaSource c;
c = a;
QCOMPARE(a, b);
QCOMPARE(a, c);
QCOMPARE(b, c);
QCOMPARE(b.type(), MediaSource::Stream);
QCOMPARE(b.fileName(), QString());
QCOMPARE(b.url(), QUrl());
QCOMPARE(b.discType(), Phonon::NoDisc);
QVERIFY(b.stream() != 0);
QCOMPARE(b.deviceName(), QString());
//QCOMPARE(b.audioCaptureDevice(), AudioCaptureDevice());
//QCOMPARE(b.videoCaptureDevice(), VideoCaptureDevice());
QCOMPARE(c.type(), MediaSource::Stream);
QCOMPARE(c.fileName(), QString());
QCOMPARE(c.url(), QUrl());
QCOMPARE(c.discType(), Phonon::NoDisc);
QVERIFY(c.stream() != 0);
QCOMPARE(c.deviceName(), QString());
//QCOMPARE(c.audioCaptureDevice(), AudioCaptureDevice());
//QCOMPARE(c.videoCaptureDevice(), VideoCaptureDevice());
delete buffer;
QCOMPARE(a.type(), MediaSource::Invalid);
QCOMPARE(b.type(), MediaSource::Invalid);
QCOMPARE(c.type(), MediaSource::Invalid);
const AbstractMediaStream *null = 0;
QCOMPARE(a.stream(), null);
QCOMPARE(b.stream(), null);
QCOMPARE(c.stream(), null);
}
示例2: testStream
void MediaSourceTest::testStream()
{
AbstractMediaStream *stream = new Stream;
MediaSource a(stream);
QCOMPARE(a.type(), MediaSource::Stream);
QCOMPARE(a.fileName(), QString());
QCOMPARE(a.url(), QUrl());
QCOMPARE(a.discType(), Phonon::NoDisc);
QCOMPARE(a.stream(), stream);
QCOMPARE(a.deviceName(), QString());
//QCOMPARE(a.audioCaptureDevice(), AudioCaptureDevice());
//QCOMPARE(a.videoCaptureDevice(), VideoCaptureDevice());
MediaSource b(a);
MediaSource c;
c = a;
QCOMPARE(a, b);
QCOMPARE(a, c);
QCOMPARE(b, c);
QCOMPARE(b.type(), MediaSource::Stream);
QCOMPARE(b.fileName(), QString());
QCOMPARE(b.url(), QUrl());
QCOMPARE(b.discType(), Phonon::NoDisc);
QCOMPARE(b.stream(), stream);
QCOMPARE(b.deviceName(), QString());
//QCOMPARE(b.audioCaptureDevice(), AudioCaptureDevice());
//QCOMPARE(b.videoCaptureDevice(), VideoCaptureDevice());
QCOMPARE(c.type(), MediaSource::Stream);
QCOMPARE(c.fileName(), QString());
QCOMPARE(c.url(), QUrl());
QCOMPARE(c.discType(), Phonon::NoDisc);
QCOMPARE(c.stream(), stream);
QCOMPARE(c.deviceName(), QString());
//QCOMPARE(c.audioCaptureDevice(), AudioCaptureDevice());
//QCOMPARE(c.videoCaptureDevice(), VideoCaptureDevice());
delete stream;
QCOMPARE(a.type(), MediaSource::Invalid);
QCOMPARE(b.type(), MediaSource::Invalid);
QCOMPARE(c.type(), MediaSource::Invalid);
const AbstractMediaStream *null = 0;
QCOMPARE(a.stream(), null);
QCOMPARE(b.stream(), null);
QCOMPARE(c.stream(), null);
}
示例3: testDiscType
void MediaSourceTest::testDiscType()
{
for (int i = 0; i <= Phonon::Vcd; ++i) {
Phonon::DiscType discType = static_cast<Phonon::DiscType>(i);
AbstractMediaStream *stream = 0;
MediaSource a(discType);
QCOMPARE(a.type(), MediaSource::Disc);
QCOMPARE(a.fileName(), QString());
QCOMPARE(a.url(), QUrl());
QCOMPARE(a.discType(), discType);
QCOMPARE(a.stream(), stream);
QCOMPARE(a.deviceName(), QString());
//QCOMPARE(a.audioCaptureDevice(), AudioCaptureDevice());
//QCOMPARE(a.videoCaptureDevice(), VideoCaptureDevice());
MediaSource b(a);
MediaSource c;
c = a;
QCOMPARE(a, b);
QCOMPARE(a, c);
QCOMPARE(b, c);
QCOMPARE(b.type(), MediaSource::Disc);
QCOMPARE(b.fileName(), QString());
QCOMPARE(b.url(), QUrl());
QCOMPARE(b.discType(), discType);
QCOMPARE(b.stream(), stream);
QCOMPARE(b.deviceName(), QString());
//QCOMPARE(b.audioCaptureDevice(), AudioCaptureDevice());
//QCOMPARE(b.videoCaptureDevice(), VideoCaptureDevice());
QCOMPARE(c.type(), MediaSource::Disc);
QCOMPARE(c.fileName(), QString());
QCOMPARE(c.url(), QUrl());
QCOMPARE(c.discType(), discType);
QCOMPARE(c.stream(), stream);
QCOMPARE(c.deviceName(), QString());
//QCOMPARE(c.audioCaptureDevice(), AudioCaptureDevice());
//QCOMPARE(c.videoCaptureDevice(), VideoCaptureDevice());
}
}
示例4: testUrl
void MediaSourceTest::testUrl()
{
QUrl url("http://www.example.com/music.ogg");
AbstractMediaStream *stream = 0;
MediaSource a(url);
QCOMPARE(a.type(), MediaSource::Url);
QCOMPARE(a.fileName(), QString());
QCOMPARE(a.url(), url);
QCOMPARE(a.discType(), Phonon::NoDisc);
QCOMPARE(a.stream(), stream);
QCOMPARE(a.deviceName(), QString());
//QCOMPARE(a.audioCaptureDevice(), AudioCaptureDevice());
//QCOMPARE(a.videoCaptureDevice(), VideoCaptureDevice());
MediaSource b(a);
MediaSource c;
c = a;
QCOMPARE(a, b);
QCOMPARE(a, c);
QCOMPARE(b, c);
QCOMPARE(b.type(), MediaSource::Url);
QCOMPARE(b.fileName(), QString());
QCOMPARE(b.url(), url);
QCOMPARE(b.discType(), Phonon::NoDisc);
QCOMPARE(b.stream(), stream);
QCOMPARE(b.deviceName(), QString());
//QCOMPARE(b.audioCaptureDevice(), AudioCaptureDevice());
//QCOMPARE(b.videoCaptureDevice(), VideoCaptureDevice());
QCOMPARE(c.type(), MediaSource::Url);
QCOMPARE(c.fileName(), QString());
QCOMPARE(c.url(), url);
QCOMPARE(c.discType(), Phonon::NoDisc);
QCOMPARE(c.stream(), stream);
QCOMPARE(c.deviceName(), QString());
//QCOMPARE(c.audioCaptureDevice(), AudioCaptureDevice());
//QCOMPARE(c.videoCaptureDevice(), VideoCaptureDevice());
}
示例5: testQtResource
void MediaSourceTest::testQtResource()
{
const QString filename(":/ogg/zero.ogg");
MediaSource a(filename);
QCOMPARE(a.type(), MediaSource::Stream);
QCOMPARE(a.fileName(), QString());
QCOMPARE(a.url(), QUrl());
QCOMPARE(a.discType(), Phonon::NoDisc);
QVERIFY(a.stream() != 0);
QCOMPARE(a.deviceName(), QString());
//QCOMPARE(a.audioCaptureDevice(), AudioCaptureDevice());
//QCOMPARE(a.videoCaptureDevice(), VideoCaptureDevice());
MediaSource b(a);
MediaSource c;
c = a;
QCOMPARE(a, b);
QCOMPARE(a, c);
QCOMPARE(b, c);
QCOMPARE(b.type(), MediaSource::Stream);
QCOMPARE(b.fileName(), QString());
QCOMPARE(b.url(), QUrl());
QCOMPARE(b.discType(), Phonon::NoDisc);
QVERIFY(b.stream() != 0);
QCOMPARE(b.deviceName(), QString());
//QCOMPARE(b.audioCaptureDevice(), AudioCaptureDevice());
//QCOMPARE(b.videoCaptureDevice(), VideoCaptureDevice());
QCOMPARE(c.type(), MediaSource::Stream);
QCOMPARE(c.fileName(), QString());
QCOMPARE(c.url(), QUrl());
QCOMPARE(c.discType(), Phonon::NoDisc);
QVERIFY(c.stream() != 0);
QCOMPARE(c.deviceName(), QString());
//QCOMPARE(c.audioCaptureDevice(), AudioCaptureDevice());
//QCOMPARE(c.videoCaptureDevice(), VideoCaptureDevice());
}
示例6: testLocalFile
void MediaSourceTest::testLocalFile()
{
QString filename("/usr/share/sounds/KDE_Beep.ogg");
AbstractMediaStream *stream = 0;
MediaSource a(filename);
QCOMPARE(a.type(), MediaSource::LocalFile);
QCOMPARE(a.fileName(), filename);
QCOMPARE(a.url(), QUrl::fromLocalFile(filename));
QCOMPARE(a.discType(), Phonon::NoDisc);
QCOMPARE(a.stream(), stream);
QCOMPARE(a.deviceName(), QString());
//QCOMPARE(a.audioCaptureDevice(), AudioCaptureDevice());
//QCOMPARE(a.videoCaptureDevice(), VideoCaptureDevice());
MediaSource b(a);
MediaSource c;
c = a;
QCOMPARE(a, b);
QCOMPARE(a, c);
QCOMPARE(b, c);
QCOMPARE(b.type(), MediaSource::LocalFile);
QCOMPARE(b.fileName(), filename);
QCOMPARE(b.url(), QUrl::fromLocalFile(filename));
QCOMPARE(b.discType(), Phonon::NoDisc);
QCOMPARE(b.stream(), stream);
QCOMPARE(b.deviceName(), QString());
//QCOMPARE(b.audioCaptureDevice(), AudioCaptureDevice());
//QCOMPARE(b.videoCaptureDevice(), VideoCaptureDevice());
QCOMPARE(c.type(), MediaSource::LocalFile);
QCOMPARE(c.fileName(), filename);
QCOMPARE(c.url(), QUrl::fromLocalFile(filename));
QCOMPARE(c.discType(), Phonon::NoDisc);
QCOMPARE(c.stream(), stream);
QCOMPARE(c.deviceName(), QString());
//QCOMPARE(c.audioCaptureDevice(), AudioCaptureDevice());
//QCOMPARE(c.videoCaptureDevice(), VideoCaptureDevice());
// non-existing files should become invalid sources
filename = "/some/invalid/file.xyz";
MediaSource invalid(filename);
QCOMPARE(invalid.type(), MediaSource::Invalid);
QCOMPARE(invalid.fileName(), QString());
//test that a relative file path is correctly set as an absolute URL
QFile testFile("foo.ogg");
bool deleteFile = false;
if (!testFile.exists()) {
deleteFile = true;
testFile.open(QIODevice::WriteOnly);
testFile.close();
}
filename = "foo.ogg";
MediaSource relative(filename);
//QCOMPARE(relative.fileName(), filename);
QFileInfo urlInfo(relative.url().toLocalFile());
QVERIFY(urlInfo.isAbsolute());
QCOMPARE(urlInfo.fileName(), filename);
QCOMPARE(urlInfo.absolutePath(), QDir::currentPath());
if (deleteFile) {
testFile.remove();
}
}