// // NotifySubtitle // void CDVBSub::NotifySubtitle() { LogDebugMediaPosition( "Subtitle arrived - media position" ); // Calculate the time stamp CSubtitle* pSubtitle( NULL ); pSubtitle = m_pSubDecoder->GetLatestSubtitle(); if( pSubtitle ) { // PTS to milliseconds ( 90khz ) LONGLONG pts( 0 ); pts = ( pSubtitle->PTS() - m_basePCR ) / 90 - m_currentTimeCompensation.Millisecs(); float fTime = (float)m_currentTimeCompensation.Millisecs(); fTime /= 1000.0f; LogDebugPTS( "subtitlePTS ", pSubtitle->PTS() ); LogDebugPTS( "m_basePCR ", m_basePCR ); LogDebugPTS( "timestamp ", pts * 90 ); LogDebugPTS( "m_CurrentSeekPosition ", m_CurrentSeekPosition ); LogDebug( "m_currentTimeCompensation %03.3f", fTime ); pSubtitle->SetTimestamp( pts ); m_prevSubtitleTimestamp = pSubtitle->PTS(); if( pts <= 0 ) { LogDebug( "Discarding subtitle, invalid timestamp!" ); DiscardOldestSubtitle(); return; } } if( m_pSubtitleObserver ) { // Notify the MediaPortal side SUBTITLE sub; GetSubtitle( 0, &sub ); LogDebug( "Calling subtitle callback" ); int retval = (*m_pSubtitleObserver)( &sub ); LogDebug( "Subtitle Callback returned" ); DiscardOldestSubtitle(); } else { LogDebug( "No callback set" ); } }
void VideoMetadata::toMap(MetadataMap &metadataMap) { if (this == NULL) return; QString coverfile; if (IsHostSet() && !GetCoverFile().startsWith("/") && !GetCoverFile().isEmpty() && !IsDefaultCoverFile(GetCoverFile())) { coverfile = generate_file_url("Coverart", GetHost(), GetCoverFile()); } else { coverfile = GetCoverFile(); } metadataMap["coverfile"] = coverfile; QString screenshotfile; if (IsHostSet() && !GetScreenshot().startsWith("/") && !GetScreenshot().isEmpty()) { screenshotfile = generate_file_url("Screenshots", GetHost(), GetScreenshot()); } else { screenshotfile = GetScreenshot(); } metadataMap["screenshotfile"] = screenshotfile; QString bannerfile; if (IsHostSet() && !GetBanner().startsWith("/") && !GetBanner().isEmpty()) { bannerfile = generate_file_url("Banners", GetHost(), GetBanner()); } else { bannerfile = GetBanner(); } metadataMap["bannerfile"] = bannerfile; QString fanartfile; if (IsHostSet() && !GetFanart().startsWith("/") && !GetFanart().isEmpty()) { fanartfile = generate_file_url("Fanart", GetHost(), GetFanart()); } else { fanartfile = GetFanart(); } metadataMap["fanartfile"] = fanartfile; metadataMap["filename"] = GetFilename(); metadataMap["title"] = GetTitle(); metadataMap["subtitle"] = GetSubtitle(); metadataMap["tagline"] = GetTagline(); metadataMap["director"] = GetDirector(); metadataMap["studio"] = GetStudio(); metadataMap["description"] = GetPlot(); metadataMap["genres"] = GetDisplayGenres(*this); metadataMap["countries"] = GetDisplayCountries(*this); metadataMap["cast"] = GetDisplayCast(*this).join(", "); metadataMap["rating"] = GetDisplayRating(GetRating()); metadataMap["length"] = GetDisplayLength(GetLength()); metadataMap["year"] = GetDisplayYear(GetYear()); metadataMap["releasedate"] = MythDateToString(GetReleaseDate(), kDateFull); metadataMap["userrating"] = GetDisplayUserRating(GetUserRating()); metadataMap["season"] = GetDisplaySeasonEpisode(GetSeason(), 1); metadataMap["episode"] = GetDisplaySeasonEpisode(GetEpisode(), 1); if (GetSeason() > 0 || GetEpisode() > 0) { metadataMap["s##e##"] = QString("s%1e%2").arg(GetDisplaySeasonEpisode (GetSeason(), 2)) .arg(GetDisplaySeasonEpisode(GetEpisode(), 2)); metadataMap["##x##"] = QString("%1x%2").arg(GetDisplaySeasonEpisode (GetSeason(), 1)) .arg(GetDisplaySeasonEpisode(GetEpisode(), 2)); } else metadataMap["s##e##"] = metadataMap["##x##"] = QString(); metadataMap["trailerstate"] = TrailerToState(GetTrailer()); metadataMap["userratingstate"] = QString::number((int)(GetUserRating())); metadataMap["watchedstate"] = WatchedToState(GetWatched()); metadataMap["videolevel"] = ParentalLevelToState(GetShowLevel()); metadataMap["insertdate"] = MythDateToString(GetInsertdate(), kDateFull); metadataMap["inetref"] = GetInetRef(); metadataMap["homepage"] = GetHomepage(); metadataMap["child_id"] = QString::number(GetChildID()); metadataMap["browseable"] = GetDisplayBrowse(GetBrowse()); metadataMap["watched"] = GetDisplayWatched(GetWatched()); metadataMap["processed"] = GetDisplayProcessed(GetProcessed()); metadataMap["category"] = GetCategory(); }