本文整理汇总了C++中QMediaTimeRange类的典型用法代码示例。如果您正苦于以下问题:C++ QMediaTimeRange类的具体用法?C++ QMediaTimeRange怎么用?C++ QMediaTimeRange使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QMediaTimeRange类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QVERIFY
void tst_QMediaTimeRange::testCtor()
{
// Default Ctor
QMediaTimeRange a;
QVERIFY(a.isEmpty());
// (qint, qint) Ctor
QMediaTimeRange b(10, 20);
QVERIFY(!b.isEmpty());
QVERIFY(b.isContinuous());
QVERIFY(b.earliestTime() == 10);
QVERIFY(b.latestTime() == 20);
// Interval Ctor
QMediaTimeRange c(QMediaTimeInterval(30, 40));
QVERIFY(!c.isEmpty());
QVERIFY(c.isContinuous());
QVERIFY(c.earliestTime() == 30);
QVERIFY(c.latestTime() == 40);
// Abnormal Interval Ctor
QMediaTimeRange d(QMediaTimeInterval(20, 10));
QVERIFY(d.isEmpty());
// Copy Ctor
QMediaTimeRange e(b);
QVERIFY(!e.isEmpty());
QVERIFY(e.isContinuous());
QVERIFY(e.earliestTime() == 10);
QVERIFY(e.latestTime() == 20);
}
示例2: availablePlaybackRanges
QMediaTimeRange QXAMediaPlayerControl::availablePlaybackRanges() const
{
QT_TRACE_FUNCTION_ENTRY;
QMediaTimeRange retVal;
RET_s_IF_p_IS_NULL(mSession, retVal);
if (mSession->isSeekable())
retVal.addInterval(0, mSession->duration());
QT_TRACE_FUNCTION_EXIT;
return retVal;
}
示例3: foreach
PassRefPtr<TimeRanges> MediaPlayerPrivate::buffered() const
{
RefPtr<TimeRanges> buffered = TimeRanges::create();
if (!m_mediaPlayerControl)
return buffered;
QMediaTimeRange playbackRanges = m_mediaPlayerControl->availablePlaybackRanges();
foreach (const QMediaTimeInterval interval, playbackRanges.intervals()) {
float rangeMin = static_cast<float>(interval.start()) / 1000.0f;
float rangeMax = static_cast<float>(interval.end()) / 1000.0f;
buffered->add(rangeMin, rangeMax);
}
return buffered.release();
}
示例4: QMediaTimeRange
void tst_QMediaTimeRange::testAssignment()
{
QMediaTimeRange x;
// Range Assignment
x = QMediaTimeRange(10, 20);
QVERIFY(!x.isEmpty());
QVERIFY(x.isContinuous());
QVERIFY(x.earliestTime() == 10);
QVERIFY(x.latestTime() == 20);
// Interval Assignment
x = QMediaTimeInterval(30, 40);
QVERIFY(!x.isEmpty());
QVERIFY(x.isContinuous());
QVERIFY(x.earliestTime() == 30);
QVERIFY(x.latestTime() == 40);
// Shared Data Check
QMediaTimeRange y;
y = x;
y.addInterval(10, 20);
QVERIFY(!x.isEmpty());
QVERIFY(x.isContinuous());
QVERIFY(x.earliestTime() == 30);
QVERIFY(x.latestTime() == 40);
}
示例5: testGetters
void tst_QMediaTimeRange::testGetters()
{
QMediaTimeRange x;
// isEmpty
QVERIFY(x.isEmpty());
x.addInterval(10, 20);
// isEmpty + isContinuous
QVERIFY(!x.isEmpty());
QVERIFY(x.isContinuous());
x.addInterval(30, 40);
// isEmpty + isContinuous + intervals + start + end
QVERIFY(!x.isEmpty());
QVERIFY(!x.isContinuous());
QVERIFY(x.intervals().count() == 2);
QVERIFY(x.intervals()[0].start() == 10);
QVERIFY(x.intervals()[0].end() == 20);
QVERIFY(x.intervals()[1].start() == 30);
QVERIFY(x.intervals()[1].end() == 40);
}