当前位置: 首页>>代码示例>>C++>>正文


C++ MediaObject::totalTime方法代码示例

本文整理汇总了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;
}
开发者ID:KDE,项目名称:kdeplasma-addons,代码行数:32,代码来源:tracklistdbushandler.cpp

示例2: updateTicker

void UBGraphicsVideoItemDelegate::updateTicker(qint64 time)
{
    Phonon::MediaObject* media = delegated()->mediaObject();
    mVideoControl->totalTimeChanged(media->totalTime());

    mVideoControl->updateTicker(time);
}
开发者ID:coachal,项目名称:Sankore-3.1,代码行数:7,代码来源:UBGraphicsVideoItemDelegate.cpp

示例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);
}
开发者ID:KDE,项目名称:juk,代码行数:11,代码来源:playermanager.cpp

示例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;
}
开发者ID:levil,项目名称:QuantumPlayer,代码行数:18,代码来源:video.cpp

示例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;
    }
}
开发者ID:shoshon,项目名称:pencil,代码行数:36,代码来源:layersound.cpp


注:本文中的phonon::MediaObject::totalTime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。