本文整理汇总了C++中phonon::MediaObject::totalTime方法的典型用法代码示例。如果您正苦于以下问题:C++ MediaObject::totalTime方法的具体用法?C++ MediaObject::totalTime怎么用?C++ MediaObject::totalTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phonon::MediaObject
的用法示例。
在下文中一共展示了MediaObject::totalTime方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetMetadata
QVariantMap TrackListDBusHandler::GetMetadata(int position)
{
QVariantMap ret;
if (position < 0 || position > m_tracks.size()-1) {
return ret;
}
//FIXME: ugly and slow
Phonon::MediaObject mediaObject;
mediaObject.setCurrentSource(m_tracks[position]);
QMultiMap<QString, QString> stringMap = mediaObject.metaData();
QMultiMap<QString, QString>::const_iterator i = stringMap.constBegin();
while (i != stringMap.constEnd()) {
bool number = false;
int value = i.value().toInt(&number);
//tracknumber always string, according to MPRIS spec
if (number && (i.key().toLower() != "tracknumber")) {
ret[i.key().toLower()] = value;
} else {
ret[i.key().toLower()] = QVariant(i.value());
}
++i;
}
ret["time"] = mediaObject.totalTime()/1000;
ret["location"] = mediaObject.currentSource().url().toString();
return ret;
}
示例2: updateTicker
void UBGraphicsVideoItemDelegate::updateTicker(qint64 time)
{
Phonon::MediaObject* media = delegated()->mediaObject();
mVideoControl->totalTimeChanged(media->totalTime());
mVideoControl->updateTicker(time);
}
示例3: seekBack
void PlayerManager::seekBack()
{
Phonon::MediaObject *mediaObject = m_media[m_curOutputPath];
const qint64 total = mediaObject->totalTime();
const qint64 newtime = mediaObject->currentTime() - total / 100;
const qint64 seekTo = qMax(qint64(0), newtime);
stopCrossfade();
mediaObject->seek(seekTo);
emit seeked(seekTo);
}
示例4: getVideoInformation
void Video::getVideoInformation()
{
QFileInfo fileInfo(videoPath);
videoName = fileInfo.fileName();
Phonon::MediaObject mediaObject;
mediaObject.setCurrentSource(videoPath);
// TODO: This doesn't work. Media needs to be loaded
qint64 totalMs = mediaObject.totalTime();
qint64 totSeconds = totalMs / 1000;
qint64 seconds = totSeconds % 60;
qint64 totMinutes = totSeconds / 60;
qint64 minutes = totMinutes % 60;
qint64 hours = totMinutes / 60;
videoTotalTime = QTime(hours, minutes, seconds);
qDebug() << videoTotalTime;
}
示例5: loadSoundAtFrame
void LayerSound::loadSoundAtFrame(QString filePathString, int frameNumber)
{
// if (getIndexAtFrame(frameNumber) == -1) addImageAtFrame(frameNumber);
int index = getIndexAtFrame(frameNumber);
if (index == -1)
addImageAtFrame(frameNumber);
index = getIndexAtFrame(frameNumber);
QFileInfo fi(filePathString);
if (fi.exists())
{
// sound[index] = new QSound(filePathString, NULL);
Phonon::MediaObject* media = new Phonon::MediaObject();
connect(media, SIGNAL(totalTimeChanged(qint64)), this, SLOT(addTimelineKey(qint64)));
media->setCurrentSource(filePathString);
// quick and dirty trick to calculate soundSize
// totalTime() return a value only after a call to media.play()
// ( and when signal totaltimechanged is emitted totalTime() returns the correct value )
Phonon::AudioOutput* audioOutput;
audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this);
Phonon::createPath(media, audioOutput);
media->play();
media->stop();
soundSize[index] = media->totalTime(); // totalTime() returns 0 now
sound[index] = media;
soundFilepath[index] = filePathString;
framesFilename[index] = fi.fileName();
framesModified[index] = true;
}
else
{
sound[index] = NULL;
soundFilepath[index] = "Wrong file";
framesFilename[index] = "Wrong file" + filePathString;
}
}