Bug CanPauseStream, CanSeekStream
#1
Question 
Hi!

I just started analysing the source of the pvr addon for DVBViewer Recording Service.
As I found out there are PVR API calls for XBMC to enable/disable the pause/seek buttons.

But these functions are never called by XBMC

PVRClient.cpp:
Code:
bool CPVRClient::OpenStream(const CPVRChannel &channel, bool bIsSwitchingChannel)
{
  bool bReturn(false);
  CloseStream();

  if(!CanPlayChannel(channel))
  {
    CLog::Log(LOGDEBUG, "add-on '%s' can not play channel '%s'", GetFriendlyName().c_str(), channel.ChannelName().c_str());
  }
  else if (!channel.StreamURL().IsEmpty())
  {
    CLog::Log(LOGDEBUG, "opening live stream on url '%s'", channel.StreamURL().c_str());
    bReturn = true;

    // the Njoy N7 sometimes doesn't switch channels, but opens a stream to the previous channel
    // when not waiting for a short period.
    // added in 1.1.0
    AddonVersion checkVersion("1.1.0");
    if (m_apiVersion >= checkVersion)
    {
      unsigned int iWaitTimeMs = m_pStruct->GetChannelSwitchDelay();
      if (iWaitTimeMs > 0)
        XbmcThreads::ThreadSleep(iWaitTimeMs);
    }
  }
  else
  {
    CLog::Log(LOGDEBUG, "opening live stream for channel '%s'", channel.ChannelName().c_str());
    PVR_CHANNEL tag;
    WriteClientChannelInfo(channel, tag);

    try
    {
      bReturn = m_pStruct->OpenLiveStream(tag);
      if (bReturn)
      {
        m_bCanPauseStream = m_pStruct->CanPauseStream();
        m_bCanSeekStream = m_pStruct->CanSeekStream();
      }
    }
    catch (exception &e) { LogException(e, __FUNCTION__); }
  }

  if (bReturn)
  {
    CPVRChannelPtr currentChannel = g_PVRChannelGroups->GetByUniqueID(channel.UniqueID(), channel.ClientID());
    CSingleLock lock(m_critSection);
    m_playingChannel      = currentChannel;
    m_bIsPlayingTV        = true;
    m_bIsPlayingRecording = false;
  }

  return bReturn;
}

This function will be called on channel open/switch of XBMC.
As channel.StreamURL().IsEmpty is not empty (it's holding the url to the live stream) these functions are not called:
Code:
m_bCanPauseStream = m_pStruct->CanPauseStream();
m_bCanSeekStream = m_pStruct->CanSeekStream();

Should it not be this way:
Code:
bool CPVRClient::OpenStream(const CPVRChannel &channel, bool bIsSwitchingChannel)
{
  bool bReturn(false);
  CloseStream();

  if(!CanPlayChannel(channel))
  {
    CLog::Log(LOGDEBUG, "add-on '%s' can not play channel '%s'", GetFriendlyName().c_str(), channel.ChannelName().c_str());
  }
  else if (!channel.StreamURL().IsEmpty())
  {
    CLog::Log(LOGDEBUG, "opening live stream on url '%s'", channel.StreamURL().c_str());
    bReturn = true;

    // the Njoy N7 sometimes doesn't switch channels, but opens a stream to the previous channel
    // when not waiting for a short period.
    // added in 1.1.0
    AddonVersion checkVersion("1.1.0");
    if (m_apiVersion >= checkVersion)
    {
      unsigned int iWaitTimeMs = m_pStruct->GetChannelSwitchDelay();
      if (iWaitTimeMs > 0)
        XbmcThreads::ThreadSleep(iWaitTimeMs);
    }
  }
  else
  {
    CLog::Log(LOGDEBUG, "opening live stream for channel '%s'", channel.ChannelName().c_str());
    PVR_CHANNEL tag;
    WriteClientChannelInfo(channel, tag);

    try
    {
      bReturn = m_pStruct->OpenLiveStream(tag);
    }
    catch (exception &e) { LogException(e, __FUNCTION__); }
  }

  if (bReturn)
  {
    m_bCanPauseStream = m_pStruct->CanPauseStream();
    m_bCanSeekStream = m_pStruct->CanSeekStream();  
    CPVRChannelPtr currentChannel = g_PVRChannelGroups->GetByUniqueID(channel.UniqueID(), channel.ClientID());
    CSingleLock lock(m_critSection);
    m_playingChannel      = currentChannel;
    m_bIsPlayingTV        = true;
    m_bIsPlayingRecording = false;
  }

  return bReturn;
}

Or I am missing somewhere else something?
Reply

Logout Mark Read Team Forum Stats Members Help
CanPauseStream, CanSeekStream0