Exemplo n.º 1
0
void cLiveStreamer::RequestSignalInfo()
{
  cMutexLock lock(&m_DeviceMutex);

  if(!Running() || m_Device == NULL) {
    return;
  }

  // do not send (and pollute the client with) signal information
  // if we are paused
  if(IsPaused())
    return;

  MsgPacket* resp = new MsgPacket(XVDR_STREAM_SIGNALINFO, XVDR_CHANNEL_STREAM);

  int DeviceNumber = m_Device->DeviceNumber() + 1;
  int Strength = 0;
  int Quality = 0;

  if(!TimeShiftMode()) {
    Strength = m_Device->SignalStrength();
    Quality = m_Device->SignalQuality();
  }

  resp->put_String(*cString::sprintf("%s #%d - %s", 
#if VDRVERSNUM < 10728
#warning "VDR versions < 1.7.28 do not support all features"
			"Unknown",
			DeviceNumber,
			"Unknown"));
#else
			(const char*)m_Device->DeviceType(),
			DeviceNumber,
			(const char*)m_Device->DeviceName()));
#endif

  // Quality:
  // 4 - NO LOCK
  // 3 - NO SYNC
  // 2 - NO VITERBI
  // 1 - NO CARRIER
  // 0 - NO SIGNAL

  if(TimeShiftMode())
  {
    resp->put_String("TIMESHIFT");
  }
  else if(Quality == -1)
  {
    resp->put_String("UNKNOWN (Incompatible device)");
    Quality = 0;
  }
  else
    resp->put_String(*cString::sprintf("%s:%s:%s:%s:%s", 
			(Quality > 4) ? "LOCKED" : "-",
			(Quality > 0) ? "SIGNAL" : "-",
			(Quality > 1) ? "CARRIER" : "-",
			(Quality > 2) ? "VITERBI" : "-",
			(Quality > 3) ? "SYNC" : "-"));

  resp->put_U32((Strength << 16 ) / 100);
  resp->put_U32((Quality << 16 ) / 100);
  resp->put_U32(0);
  resp->put_U32(0);

  // get provider & service information
  const cChannel* channel = FindChannelByUID(m_uid);
  if(channel != NULL) {
    // put in provider name
    resp->put_String(channel->Provider());

    // what the heck should be the service name ?
    // using PortalName for now
    resp->put_String(channel->PortalName());
  }
  else {
    resp->put_String("");
    resp->put_String("");
  }

  DEBUGLOG("RequestSignalInfo");
  m_Queue->Add(resp);
}
Exemplo n.º 2
0
void cLiveStreamer::RequestSignalInfo()
{
  // do not send (and pollute the client with) signal information
  // if we are paused
  if(IsPaused())
    return;

  MsgPacket* resp = new MsgPacket(XVDR_STREAM_SIGNALINFO, XVDR_CHANNEL_STREAM);

  int DeviceNumber = m_Device->DeviceNumber() + 1;
  int Strength = 0;
  int Quality = 0;

  if(!TimeShiftMode()) {
    Strength = m_Device->SignalStrength();
    Quality = m_Device->SignalQuality();
  }

  resp->put_String(*cString::sprintf("%s #%d - %s", 
#if VDRVERSNUM < 10728
#warning "VDR versions < 1.7.28 do not support all features"
			"Unknown",
			DeviceNumber,
			"Unknown"));
#else
			(const char*)m_Device->DeviceType(),
			DeviceNumber,
			(const char*)m_Device->DeviceName()));
#endif

  // Quality:
  // 4 - NO LOCK
  // 3 - NO SYNC
  // 2 - NO VITERBI
  // 1 - NO CARRIER
  // 0 - NO SIGNAL

  if(TimeShiftMode())
  {
    resp->put_String("TIMESHIFT");
  }
  else if(Quality == -1)
  {
    resp->put_String("UNKNOWN (Incompatible device)");
    Quality = 0;
  }
  else
    resp->put_String(*cString::sprintf("%s:%s:%s:%s:%s", 
			(Quality > 4) ? "LOCKED" : "-",
			(Quality > 0) ? "SIGNAL" : "-",
			(Quality > 1) ? "CARRIER" : "-",
			(Quality > 2) ? "VITERBI" : "-",
			(Quality > 3) ? "SYNC" : "-"));

  resp->put_U32((Strength << 16 ) / 100);
  resp->put_U32((Quality << 16 ) / 100);
  resp->put_U32(0);
  resp->put_U32(0);

  DEBUGLOG("RequestSignalInfo");
  m_Queue->Add(resp);
}