Skip to content

Commit

Permalink
Merge branch 'master' into pvr-ppa
Browse files Browse the repository at this point in the history
  • Loading branch information
opdenkamp committed Nov 11, 2011
2 parents 5554c5f + 1f1102b commit 8e4b699
Show file tree
Hide file tree
Showing 27 changed files with 652 additions and 43 deletions.
7 changes: 7 additions & 0 deletions addons/pvr.mythtv/resources/language/German/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<strings>
<!-- settings labels -->
<string id="30000">MythTV Backend Hostname oder IP</string>
<string id="30001">MythXML Port</string>
</strings>

434 changes: 434 additions & 0 deletions language/Swedish/strings.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions xbmc/FileItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,7 @@ bool CFileItem::IsVideo() const
if (HasVideoInfoTag()) return true;
if (HasMusicInfoTag()) return false;
if (HasPictureInfoTag()) return false;
if (IsPVRRecording()) return true;

if (IsHDHomeRun() || IsTuxBox() || URIUtils::IsDVD(m_strPath) || IsSlingbox())
return true;
Expand Down
7 changes: 6 additions & 1 deletion xbmc/Util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -775,8 +775,13 @@ void CUtil::ClearSubtitles()

void CUtil::ClearTempFonts()
{
CStdString searchPath = "special://temp/fonts/";

if (!CFile::Exists(searchPath))
return;

CFileItemList items;
CDirectory::GetDirectory("special://temp/fonts/", items, "", false, false, XFILE::DIR_CACHE_NEVER);
CDirectory::GetDirectory(searchPath, items, "", false, false, XFILE::DIR_CACHE_NEVER);

for (int i=0; i<items.Size(); ++i)
{
Expand Down
11 changes: 11 additions & 0 deletions xbmc/XBDateTime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,17 @@ CStdString CDateTime::GetAsDBDateTime() const
return date;
}

CStdString CDateTime::GetAsSaveString() const
{
SYSTEMTIME st;
GetAsSystemTime(st);

CStdString date;
date.Format("%04i%02i%02i_%02i%02i%02i", st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);

return date;
}

void CDateTime::SetFromUTCDateTime(const CDateTime &dateTime)
{
TIME_ZONE_INFORMATION tz;
Expand Down
1 change: 1 addition & 0 deletions xbmc/XBDateTime.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ class CDateTime : public IArchivable
void GetAsTimeStamp(FILETIME& time) const;

CDateTime GetAsUTCDateTime() const;
CStdString GetAsSaveString() const;
CStdString GetAsDBDateTime() const;
CStdString GetAsDBDate() const;
CStdString GetAsLocalizedDate(bool longDate=false, bool withShortNames=true) const;
Expand Down
9 changes: 9 additions & 0 deletions xbmc/addons/Scraper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,9 @@ std::vector<CMusicAlbumInfo> CScraper::FindAlbum(CFileCurl &fcurl, const CStdStr
for ( ; pxeLink && pxeLink->FirstChild(); pxeLink = pxeLink->NextSiblingElement("url"))
scurlAlbum.ParseElement(pxeLink);

if (!scurlAlbum.m_url.size())
continue;

CMusicAlbumInfo ali(sTitle, sArtist, sAlbumName, scurlAlbum);

TiXmlElement* pxeRel = pxeAlbum->FirstChildElement("relevance");
Expand Down Expand Up @@ -735,6 +738,9 @@ std::vector<CMusicArtistInfo> CScraper::FindArtist(CFileCurl &fcurl,
for ( ; pxeLink && pxeLink->FirstChild(); pxeLink = pxeLink->NextSiblingElement("url"))
scurlArtist.ParseElement(pxeLink);

if (!scurlArtist.m_url.size())
continue;

CMusicArtistInfo ari(pxnTitle->FirstChild()->Value(), scurlArtist);
XMLUtils::GetString(pxeArtist, "genre", ari.GetArtist().strGenre);
XMLUtils::GetString(pxeArtist, "year", ari.GetArtist().strBorn);
Expand Down Expand Up @@ -898,6 +904,9 @@ bool CScraper::GetAlbumDetails(CFileCurl &fcurl, const CScraperUrl &scurl, CAlbu
bool CScraper::GetArtistDetails(CFileCurl &fcurl, const CScraperUrl &scurl,
const CStdString &sSearch, CArtist &artist)
{
if (!scurl.m_url.size())
return false;

CLog::Log(LOGDEBUG, "%s: Reading '%s' ('%s') using %s scraper "
"(file: '%s', content: '%s', version: '%s')", __FUNCTION__,
scurl.m_url[0].m_url.c_str(), sSearch.c_str(), Name().c_str(), Path().c_str(),
Expand Down
25 changes: 25 additions & 0 deletions xbmc/cores/dvdplayer/DVDAudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,31 @@ DWORD CDVDAudio::AddPackets(const DVDAudioFrame &audioframe)
return total;
}

double CDVDAudio::AddSilence(double delay)
{
CLog::Log(LOGDEBUG, "CDVDAudio::AddSilence - %f seconds", delay);
DVDAudioFrame audioframe;
audioframe.passthrough = m_bPassthrough;
audioframe.channels = m_iChannels;
audioframe.sample_rate = m_iBitrate;
audioframe.bits_per_sample = m_iBitsPerSample;
audioframe.size = m_iChannels * (m_iBitsPerSample>>3);
audioframe.data = (BYTE*)calloc(1, audioframe.size);
if(audioframe.data == NULL)
return 0.0;
unsigned samples = m_iBitrate * delay;
unsigned added = 0;
for(; added < samples; added++)
{
if(AddPackets(audioframe) != audioframe.size)
break;
}
if(added < samples)
CLog::Log(LOGDEBUG, "CDVDAudio::AddSilence - failed to %d silence samples of %u", samples - added, samples);
free(audioframe.data);
return (double)added / m_iBitrate;
}

void CDVDAudio::Finish()
{
CSingleLock lock (m_critSection);
Expand Down
1 change: 1 addition & 0 deletions xbmc/cores/dvdplayer/DVDAudio.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class CDVDAudio
bool IsValidFormat(const DVDAudioFrame &audioframe);
void Destroy();
DWORD AddPackets(const DVDAudioFrame &audioframe);
double AddSilence(double delay);
double GetDelay(); // returns the time it takes to play a packet if we add one at this time
double GetCacheTime(); // returns total amount of data cached in audio output at this time
double GetCacheTotal(); // returns total amount the audio device can buffer
Expand Down
18 changes: 12 additions & 6 deletions xbmc/cores/dvdplayer/DVDPlayerAudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -386,12 +386,18 @@ int CDVDPlayerAudio::DecodeFrame(DVDAudioFrame &audioframe, bool bDropPacket)

CDVDMsg* pMsg;
int priority = (m_speed == DVD_PLAYSPEED_PAUSE && m_started) ? 1 : 0;

int timeout;
if(m_duration > 0)
timeout = (int)(1000 * (m_duration / DVD_TIME_BASE + m_dvdAudio.GetCacheTime()));

double cached = m_dvdAudio.GetCacheTime();
if(cached > 0.0)
{
if(cached > 0.2)
timeout = (int)(1000 * (cached - 0.2));
else
timeout = 0; /* in a hurry, try to fill with something as soon as possible */
}
else
timeout = 1000;
timeout = 1000; /* if nothing cached, we can just as well wait for a while */

// read next packet and return -1 on error
MsgQueueReturnCode ret = m_messageQueue.Get(&pMsg, timeout, priority);
Expand Down Expand Up @@ -550,9 +556,9 @@ void CDVDPlayerAudio::Process()
{
m_stalled = true;

// Flush as the audio output may keep looping if we don't
// Add some silence to keep renderer from draining
if(m_speed == DVD_PLAYSPEED_NORMAL)
m_dvdAudio.Flush();
m_dvdAudio.AddSilence(0.5);

continue;
}
Expand Down
14 changes: 8 additions & 6 deletions xbmc/cores/dvdplayer/DVDPlayerVideo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -919,13 +919,14 @@ int CDVDPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts)
DVDVideoPicture* pPicture = &picture;

#ifdef HAS_VIDEO_PLAYBACK
double config_framerate = m_bFpsInvalid ? 0.0 : m_fFrameRate;
/* check so that our format or aspect has changed. if it has, reconfigure renderer */
if (!g_renderManager.IsConfigured()
|| m_output.width != pPicture->iWidth
|| m_output.height != pPicture->iHeight
|| m_output.dwidth != pPicture->iDisplayWidth
|| m_output.dheight != pPicture->iDisplayHeight
|| m_output.framerate != m_fFrameRate
|| m_output.framerate != config_framerate
|| m_output.color_format != (unsigned int)pPicture->format
|| m_output.extended_format != pPicture->extended_format
|| ( m_output.color_matrix != pPicture->color_matrix && pPicture->color_matrix != 0 ) // don't reconfigure on unspecified
Expand All @@ -935,7 +936,7 @@ int CDVDPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts)
|| m_output.color_range != pPicture->color_range)
{
CLog::Log(LOGNOTICE, " fps: %f, pwidth: %i, pheight: %i, dwidth: %i, dheight: %i",
m_fFrameRate, pPicture->iWidth, pPicture->iHeight, pPicture->iDisplayWidth, pPicture->iDisplayHeight);
config_framerate, pPicture->iWidth, pPicture->iHeight, pPicture->iDisplayWidth, pPicture->iDisplayHeight);
unsigned flags = 0;
if(pPicture->color_range == 1)
flags |= CONF_FLAGS_YUV_FULLRANGE;
Expand Down Expand Up @@ -1055,8 +1056,8 @@ int CDVDPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts)
m_bAllowFullscreen = false; // only allow on first configure
}

CLog::Log(LOGDEBUG,"%s - change configuration. %dx%d. framerate: %4.2f. format: %s",__FUNCTION__,pPicture->iWidth, pPicture->iHeight, m_bFpsInvalid ? 0.0 : m_fFrameRate, formatstr.c_str());
if(!g_renderManager.Configure(pPicture->iWidth, pPicture->iHeight, pPicture->iDisplayWidth, pPicture->iDisplayHeight, m_bFpsInvalid ? 0.0 : m_fFrameRate, flags, pPicture->extended_format))
CLog::Log(LOGDEBUG,"%s - change configuration. %dx%d. framerate: %4.2f. format: %s",__FUNCTION__,pPicture->iWidth, pPicture->iHeight, config_framerate, formatstr.c_str());
if(!g_renderManager.Configure(pPicture->iWidth, pPicture->iHeight, pPicture->iDisplayWidth, pPicture->iDisplayHeight, config_framerate, flags, pPicture->extended_format))
{
CLog::Log(LOGERROR, "%s - failed to configure renderer", __FUNCTION__);
return EOS_ABORT;
Expand All @@ -1066,7 +1067,7 @@ int CDVDPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts)
m_output.height = pPicture->iHeight;
m_output.dwidth = pPicture->iDisplayWidth;
m_output.dheight = pPicture->iDisplayHeight;
m_output.framerate = m_fFrameRate;
m_output.framerate = config_framerate;
m_output.color_format = pPicture->format;
m_output.extended_format = pPicture->extended_format;
m_output.color_matrix = pPicture->color_matrix;
Expand Down Expand Up @@ -1524,10 +1525,11 @@ void CDVDPlayerVideo::CalcFrameRate()
if (m_iFrameRateCount >= MathUtils::round_int(framerate) * m_iFrameRateLength)
{
//store the calculated framerate if it differs too much from m_fFrameRate
if (fabs(m_fFrameRate - (m_fStableFrameRate / m_iFrameRateCount)) > MAXFRAMERATEDIFF)
if (fabs(m_fFrameRate - (m_fStableFrameRate / m_iFrameRateCount)) > MAXFRAMERATEDIFF || m_bFpsInvalid)
{
CLog::Log(LOGDEBUG,"%s framerate was:%f calculated:%f", __FUNCTION__, m_fFrameRate, m_fStableFrameRate / m_iFrameRateCount);
m_fFrameRate = m_fStableFrameRate / m_iFrameRateCount;
m_bFpsInvalid = false;
}

//reset the stored framerates
Expand Down
5 changes: 5 additions & 0 deletions xbmc/filesystem/PVRFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,11 @@ bool CPVRFile::Rename(const CURL& url, const CURL& urlnew)
return false;
}

bool CPVRFile::Exists(const CURL& url)
{
return g_PVRRecordings->GetByPath(url.Get()) != NULL;
}

int CPVRFile::IoControl(EIoControl request, void *param)
{
if (request == IOCTRL_SEEK_POSSIBLE)
Expand Down
2 changes: 1 addition & 1 deletion xbmc/filesystem/PVRFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class CPVRFile

virtual bool Delete(const CURL& url);
virtual bool Rename(const CURL& url, const CURL& urlnew);
virtual bool Exists(const CURL& url) { return false; }
virtual bool Exists(const CURL& url);

virtual ILiveTVInterface* GetLiveTV() {return (ILiveTVInterface*)this;}

Expand Down
1 change: 0 additions & 1 deletion xbmc/guilib/GUIWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,6 @@ void CGUIWindow::OnInitWindow()
}

// Called on window close.
// * Executes the window close animation(s)
// * Saves control state(s)
// Override this function and call the base class before doing any dynamic memory freeing
void CGUIWindow::OnDeinitWindow(int nextWindowID)
Expand Down
2 changes: 2 additions & 0 deletions xbmc/pvr/addons/PVRClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ inline void PVRWriteClientTimerInfo(const CPVRTimerInfoTag &xbmcTimer, PVR_TIMER
addonTimer.strSummary = xbmcTimer.m_strSummary.c_str();
addonTimer.iMarginStart = xbmcTimer.m_iMarginStart;
addonTimer.iMarginEnd = xbmcTimer.m_iMarginEnd;
addonTimer.iGenreType = xbmcTimer.m_iGenreType;
addonTimer.iGenreSubType = xbmcTimer.m_iGenreSubType;
}

/*!
Expand Down
24 changes: 20 additions & 4 deletions xbmc/pvr/recordings/PVRRecording.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,20 +155,36 @@ void CPVRRecording::Update(const CPVRRecording &tag)
m_strChannelName = tag.m_strChannelName;
m_strGenre = tag.m_strGenre;

CStdString strShow;
strShow.Format("%s - ", g_localizeStrings.Get(20364).c_str());
if (m_strPlotOutline.Left(strShow.size()).Equals(strShow))
{
CStdString strEpisode = m_strPlotOutline;
CStdString strTitle = m_strDirectory;

int pos = strTitle.ReverseFind('/');
strTitle.erase(0, pos + 1);
strEpisode.erase(0, strShow.size());
m_strTitle.Format("%s - %s", strTitle.c_str(), strEpisode);
pos = strEpisode.Find('-');
strEpisode.erase(0, pos + 2);
m_strPlotOutline = strEpisode;
}
UpdatePath();
}

void CPVRRecording::UpdatePath(void)
{
CStdString strTitle = m_strTitle;
CStdString strDatetime = m_recordingTime.GetAsSaveString();
strTitle.Replace('/','-');

if (m_strDirectory != "")
m_strFileNameAndPath.Format("pvr://recordings/client_%04i/%s/%s.pvr",
m_iClientId, m_strDirectory.c_str(), strTitle.c_str());
m_strFileNameAndPath.Format("pvr://recordings/%s/%s/%s.pvr",
m_strDirectory.c_str(), strDatetime.c_str(), strTitle.c_str());
else
m_strFileNameAndPath.Format("pvr://recordings/client_%04i/%s.pvr",
m_iClientId, strTitle.c_str());
m_strFileNameAndPath.Format("pvr://recordings/%s/%s.pvr",
strDatetime.c_str(), strTitle.c_str());
}

const CDateTime &CPVRRecording::RecordingTimeAsLocalTime(void) const
Expand Down
15 changes: 2 additions & 13 deletions xbmc/pvr/recordings/PVRRecordings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ bool CPVRRecordings::IsDirectoryMember(const CStdString &strDirectory, const CSt

void CPVRRecordings::GetContents(const CStdString &strDirectory, CFileItemList *results) const
{
CStdString strPath;
for (unsigned int iRecordingPtr = 0; iRecordingPtr < size(); iRecordingPtr++)
{
CPVRRecording *current = at(iRecordingPtr);
Expand All @@ -103,8 +102,7 @@ void CPVRRecordings::GetContents(const CStdString &strDirectory, CFileItemList *
CFileItemPtr pFileItem(new CFileItem(*current));
pFileItem->SetLabel2(current->RecordingTimeAsLocalTime().GetAsLocalizedDateTime(true, false));
pFileItem->m_dateTime = current->RecordingTimeAsLocalTime();
strPath.Format("pvr://recordings/%05i-%s.pvr", current->m_iClientId, current->m_strRecordingId);
pFileItem->SetPath(strPath);
pFileItem->SetPath(current->m_strFileNameAndPath);
results->Add(pFileItem);
}
}
Expand Down Expand Up @@ -262,23 +260,14 @@ CPVRRecording *CPVRRecordings::GetByPath(const CStdString &path)

if (fileName.Left(11) == "recordings/")
{
// remove "recordings/" from filename
fileName.erase(0,11);
int iClientID = atoi(fileName.c_str());
// remove client id from filename
fileName.erase(0,6);

if (fileName.IsEmpty())
return tag;

// remove ".pvr" from filename
fileName.erase(fileName.end() - 4, fileName.end());

for (unsigned int iRecordingPtr = 0; iRecordingPtr < size(); iRecordingPtr++)
{
CPVRRecording *recording = at(iRecordingPtr);

if (recording->m_iClientId == iClientID && recording->m_strRecordingId.Equals(fileName))
if(path.Equals(recording->m_strFileNameAndPath))
{
tag = recording;
break;
Expand Down
15 changes: 14 additions & 1 deletion xbmc/pvr/timers/PVRTimerInfoTag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ CPVRTimerInfoTag::CPVRTimerInfoTag(void)
m_iMarginStart = g_guiSettings.GetInt("pvrrecord.marginstart");
m_iMarginEnd = g_guiSettings.GetInt("pvrrecord.marginend");
m_strGenre = "";
m_iGenreType = 0;
m_iGenreSubType = 0;
m_StartTime = CDateTime::GetUTCDateTime();
m_StopTime = m_StartTime;
m_state = PVR_TIMER_STATE_SCHEDULED;
Expand All @@ -83,6 +85,8 @@ CPVRTimerInfoTag::CPVRTimerInfoTag(const PVR_TIMER &timer, CPVRChannel *channel,
m_iMarginStart = timer.iMarginStart;
m_iMarginEnd = timer.iMarginEnd;
m_strGenre = CEpg::ConvertGenreIdToString(timer.iGenreType, timer.iGenreSubType);
m_iGenreType = timer.iGenreType;
m_iGenreSubType = timer.iGenreSubType;
m_epgInfo = NULL;
m_channel = channel;
m_bIsRadio = channel && channel->IsRadio();
Expand All @@ -93,7 +97,11 @@ CPVRTimerInfoTag::CPVRTimerInfoTag(const PVR_TIMER &timer, CPVRChannel *channel,
{
m_epgInfo = channel->GetEPG()->GetTag(timer.iEpgUid, m_StartTime);
if (m_epgInfo)
{
m_strGenre = m_epgInfo->Genre();
m_iGenreType = m_epgInfo->GenreType();
m_iGenreSubType = m_epgInfo->GenreSubType();
}
}

UpdateSummary();
Expand Down Expand Up @@ -308,12 +316,15 @@ bool CPVRTimerInfoTag::UpdateEntry(const CPVRTimerInfoTag &tag)
m_iMarginEnd = tag.m_iMarginEnd;
m_epgInfo = tag.m_epgInfo;
m_strGenre = tag.m_strGenre;

m_iGenreType = tag.m_iGenreType;
m_iGenreSubType = tag.m_iGenreSubType;
/* try to find an epg event */
UpdateEpgEvent();
if (m_epgInfo != NULL)
{
m_strGenre = m_epgInfo->Genre();
m_iGenreType = m_epgInfo->GenreType();
m_iGenreSubType = m_epgInfo->GenreSubType();
m_epgInfo->SetTimer(this);
}

Expand Down Expand Up @@ -471,6 +482,8 @@ CPVRTimerInfoTag *CPVRTimerInfoTag::CreateFromEpg(const CEpgInfoTag &tag)
newTag->m_iClientChannelUid = channel->UniqueID();
newTag->m_iClientId = channel->ClientID();
newTag->m_bIsRadio = channel->IsRadio();
newTag->m_iGenreType = tag.GenreType();
newTag->m_iGenreSubType = tag.GenreSubType();
newTag->SetStartFromUTC(newStart);
newTag->SetEndFromUTC(newEnd);

Expand Down
Loading

0 comments on commit 8e4b699

Please sign in to comment.