예제 #1
0
bool PlayerContext::GetPlayingInfoMap(InfoMap &infoMap) const
{
    bool loaded = false;
    LockPlayingInfo(__FILE__, __LINE__);
    if (playingInfo)
    {
        playingInfo->ToMap(infoMap);
        infoMap["tvstate"]  = StateToString(playingState);
        infoMap["iconpath"] = ChannelUtil::GetIcon(playingInfo->GetChanID());
        if ((playingInfo->IsVideoFile() || playingInfo->IsVideoDVD() ||
            playingInfo->IsVideoBD()) && playingInfo->GetPathname() !=
            playingInfo->GetBasename())
        {
            infoMap["coverartpath"] = VideoMetaDataUtil::GetArtPath(
                playingInfo->GetPathname(), "Coverart");
            infoMap["fanartpath"] = VideoMetaDataUtil::GetArtPath(
                playingInfo->GetPathname(), "Fanart");
            infoMap["bannerpath"] = VideoMetaDataUtil::GetArtPath(
                playingInfo->GetPathname(), "Banners");
            infoMap["screenshotpath"] = VideoMetaDataUtil::GetArtPath(
                playingInfo->GetPathname(), "Screenshots");
        }
        if (player)
            player->GetCodecDescription(infoMap);

        infoMap.detach();
        loaded = true;
    }
    UnlockPlayingInfo(__FILE__, __LINE__);
    return loaded;
}
예제 #2
0
 /**
 * \brief Show and update the edit mode On Screen Display. The cut regions
 *        are only refreshed if the deleteMap has been updated.
 */
void DeleteMap::UpdateOSD(uint64_t frame, double frame_rate, OSD *osd)
{
    if (!osd || !m_ctx)
        return;
    CleanMap();

    InfoMap infoMap;
    m_ctx->LockPlayingInfo(__FILE__, __LINE__);
    if (m_ctx->playingInfo)
        m_ctx->playingInfo->ToMap(infoMap);
    infoMap.detach();
    m_ctx->UnlockPlayingInfo(__FILE__, __LINE__);

    QString cutmarker = " ";
    if (IsInDelete(frame))
        cutmarker = tr("cut");

    uint64_t total = m_ctx->player->GetTotalFrameCount();
    QString timestr = CreateTimeString(frame, false, frame_rate, true);
    QString relTimeDisplay;
    relTimeDisplay = CreateTimeString(frame, true, frame_rate, false);
    QString relLengthDisplay;
    relLengthDisplay = CreateTimeString(total, true, frame_rate, false);
    infoMap["timedisplay"]  = timestr;
    infoMap["framedisplay"] = QString::number(frame);
    infoMap["cutindicator"] = cutmarker;
    infoMap["title"]        = tr("Edit");
    infoMap["seekamount"]   = m_seekText;;
    infoMap["reltimedisplay"] = relTimeDisplay;
    infoMap["rellengthdisplay"] = relLengthDisplay;
    //: example: "13:24 (10:23 of 24:37)"
    infoMap["fulltimedisplay"] = tr("%3 (%1 of %2)").arg(relTimeDisplay)
        .arg(relLengthDisplay).arg(timestr);

    QHash<QString,float> posMap;
    posMap.insert("position", (float)((double)frame/(double)total));
    osd->SetValues("osd_program_editor", posMap, kOSDTimeout_None);
    osd->SetText("osd_program_editor", infoMap,  kOSDTimeout_None);
    if (m_changed || total != m_cachedTotalForOSD)
        osd->SetRegions("osd_program_editor", m_deleteMap, total);
    m_changed = false;
    m_cachedTotalForOSD = total;
}