Exemple #1
0
bool CPVRClients::OpenStream(const CPVRRecordingPtr &channel)
{
  assert(channel.get());

  bool bReturn(false);
  CloseStream();

  /* try to open the recording stream on the client */
  PVR_CLIENT client;
  if (GetConnectedClient(channel->m_iClientId, client) &&
      client->OpenStream(channel))
  {
    CSingleLock lock(m_critSection);

    CDateTime endTime = channel->RecordingTimeAsLocalTime() +
        CDateTimeSpan(0, 0, channel->GetDuration() / 60, channel->GetDuration() % 60);

    m_bIsRecordingInProgress = (endTime > CDateTime::GetCurrentDateTime());

    if (m_bIsRecordingInProgress)
      CLog::Log(LOGNOTICE, "PVRClients - %s - recording is still in progress, end time = %s", __FUNCTION__, endTime.GetAsDBDateTime().c_str());

    m_playingClientId = channel->m_iClientId;
    m_bIsPlayingRecording = true;
    m_strPlayingClientName = client->GetFriendlyName();
    bReturn = true;
  }

  return bReturn;
}