mirror of
https://github.com/rofafor/vdr-plugin-satip.git
synced 2023-10-10 13:37:42 +02:00
Added new debugging modes.
This commit is contained in:
parent
23dce9e205
commit
38f815d439
4
config.c
4
config.c
@ -14,7 +14,7 @@ cSatipConfig SatipConfig;
|
||||
cSatipConfig::cSatipConfig(void)
|
||||
: operatingModeM(eOperatingModeLow),
|
||||
#ifdef DEBUG
|
||||
loggingM(eLoggingMask),
|
||||
loggingM(eLoggingDebug1 & eLoggingDebug2),
|
||||
#else
|
||||
loggingM(eLoggingNormal),
|
||||
#endif
|
||||
@ -68,6 +68,6 @@ void cSatipConfig::SetDisabledFilters(unsigned int indexP, int numberP)
|
||||
|
||||
void cSatipConfig::SetConfigDirectory(const char *directoryP)
|
||||
{
|
||||
debug("%s(%s)", __PRETTY_FUNCTION__, directoryP);
|
||||
debug1("%s(%s)", __PRETTY_FUNCTION__, directoryP);
|
||||
ERROR_IF(!realpath(directoryP, configDirectoryM), "Cannot canonicalize configuration directory");
|
||||
}
|
||||
|
22
config.h
22
config.h
@ -32,9 +32,15 @@ public:
|
||||
};
|
||||
enum {
|
||||
eLoggingNormal = 0x00,
|
||||
eLoggingDebug = 0x01,
|
||||
eLoggingExtra = 0x02,
|
||||
eLoggingMask = 0x0F
|
||||
eLoggingDebug1 = 0x01,
|
||||
eLoggingDebug2 = 0x02,
|
||||
eLoggingDebug3 = 0x04,
|
||||
eLoggingDebug4 = 0x08,
|
||||
eLoggingDebug5 = 0x10,
|
||||
eLoggingDebug6 = 0x20,
|
||||
eLoggingDebug7 = 0x40,
|
||||
eLoggingDebug8 = 0x80,
|
||||
eLoggingMask = 0xFF
|
||||
};
|
||||
cSatipConfig();
|
||||
unsigned int GetOperatingMode(void) const { return operatingModeM; }
|
||||
@ -44,8 +50,14 @@ public:
|
||||
bool IsOperatingModeHigh(void) const { return (operatingModeM == eOperatingModeHigh); }
|
||||
void ToggleOperatingMode(void) { operatingModeM = (operatingModeM + 1) % eOperatingModeCount; }
|
||||
unsigned int GetLogging(void) const { return loggingM; }
|
||||
bool IsLoggingDebug(void) const { return (loggingM & eLoggingDebug); }
|
||||
bool IsLoggingExtra(void) const { return (loggingM & eLoggingExtra); }
|
||||
bool IsLoggingDebug1(void) const { return (loggingM & eLoggingDebug1); }
|
||||
bool IsLoggingDebug2(void) const { return (loggingM & eLoggingDebug2); }
|
||||
bool IsLoggingDebug3(void) const { return (loggingM & eLoggingDebug3); }
|
||||
bool IsLoggingDebug4(void) const { return (loggingM & eLoggingDebug4); }
|
||||
bool IsLoggingDebug5(void) const { return (loggingM & eLoggingDebug5); }
|
||||
bool IsLoggingDebug6(void) const { return (loggingM & eLoggingDebug6); }
|
||||
bool IsLoggingDebug7(void) const { return (loggingM & eLoggingDebug7); }
|
||||
bool IsLoggingDebug8(void) const { return (loggingM & eLoggingDebug8); }
|
||||
unsigned int GetEITScan(void) const { return eitScanM; }
|
||||
unsigned int GetUseBytes(void) const { return useBytesM; }
|
||||
const char *GetConfigDirectory(void) const { return configDirectoryM; }
|
||||
|
62
device.c
62
device.c
@ -41,7 +41,7 @@ cSatipDevice::cSatipDevice(unsigned int indexP)
|
||||
|
||||
cSatipDevice::~cSatipDevice()
|
||||
{
|
||||
debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
debug1("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
// Stop section handler
|
||||
StopSectionHandler();
|
||||
DELETE_POINTER(pSectionFilterHandlerM);
|
||||
@ -51,7 +51,7 @@ cSatipDevice::~cSatipDevice()
|
||||
|
||||
bool cSatipDevice::Initialize(unsigned int deviceCountP)
|
||||
{
|
||||
debug("%s(%u)", __PRETTY_FUNCTION__, deviceCountP);
|
||||
debug1("%s(%u)", __PRETTY_FUNCTION__, deviceCountP);
|
||||
if (deviceCountP > SATIP_MAX_DEVICES)
|
||||
deviceCountP = SATIP_MAX_DEVICES;
|
||||
for (unsigned int i = 0; i < deviceCountP; ++i)
|
||||
@ -63,7 +63,7 @@ bool cSatipDevice::Initialize(unsigned int deviceCountP)
|
||||
|
||||
void cSatipDevice::Shutdown(void)
|
||||
{
|
||||
debug("%s", __PRETTY_FUNCTION__);
|
||||
debug1("%s", __PRETTY_FUNCTION__);
|
||||
for (int i = 0; i < SATIP_MAX_DEVICES; ++i) {
|
||||
if (SatipDevicesS[i])
|
||||
SatipDevicesS[i]->CloseDvr();
|
||||
@ -73,7 +73,7 @@ void cSatipDevice::Shutdown(void)
|
||||
unsigned int cSatipDevice::Count(void)
|
||||
{
|
||||
unsigned int count = 0;
|
||||
debug("%s", __PRETTY_FUNCTION__);
|
||||
debug1("%s", __PRETTY_FUNCTION__);
|
||||
for (unsigned int i = 0; i < SATIP_MAX_DEVICES; ++i) {
|
||||
if (SatipDevicesS[i] != NULL)
|
||||
count++;
|
||||
@ -83,10 +83,10 @@ unsigned int cSatipDevice::Count(void)
|
||||
|
||||
cSatipDevice *cSatipDevice::GetSatipDevice(int cardIndexP)
|
||||
{
|
||||
//debug("%s(%d)", __PRETTY_FUNCTION__, cardIndexP);
|
||||
debug8("%s(%d)", __PRETTY_FUNCTION__, cardIndexP);
|
||||
for (unsigned int i = 0; i < SATIP_MAX_DEVICES; ++i) {
|
||||
if (SatipDevicesS[i] && (SatipDevicesS[i]->CardIndex() == cardIndexP)) {
|
||||
//debug("%s(%d): Found!", __PRETTY_FUNCTION__, cardIndexP);
|
||||
debug3("%s(%d): Found!", __PRETTY_FUNCTION__, cardIndexP);
|
||||
return SatipDevicesS[i];
|
||||
}
|
||||
}
|
||||
@ -127,7 +127,7 @@ cString cSatipDevice::GetSatipStatus(void)
|
||||
|
||||
cString cSatipDevice::GetGeneralInformation(void)
|
||||
{
|
||||
//debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
debug8("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
return cString::sprintf("SAT>IP device: %d\nCardIndex: %d\nStream: %s\nSignal: %s\nStream bitrate: %s\n%sChannel: %s",
|
||||
deviceIndexM, CardIndex(),
|
||||
pTunerM ? *pTunerM->GetInformation() : "",
|
||||
@ -139,13 +139,13 @@ cString cSatipDevice::GetGeneralInformation(void)
|
||||
|
||||
cString cSatipDevice::GetPidsInformation(void)
|
||||
{
|
||||
//debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
debug8("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
return GetPidStatistic();
|
||||
}
|
||||
|
||||
cString cSatipDevice::GetFiltersInformation(void)
|
||||
{
|
||||
//debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
debug8("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
return cString::sprintf("Active section filters:\n%s", pSectionFilterHandlerM ? *pSectionFilterHandlerM->GetInformation() : "");
|
||||
}
|
||||
|
||||
@ -181,43 +181,43 @@ cString cSatipDevice::GetInformation(unsigned int pageP)
|
||||
|
||||
bool cSatipDevice::Ready(void)
|
||||
{
|
||||
//debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
debug8("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
return ((cSatipDiscover::GetInstance()->GetServerCount() > 0) || (createdM.Elapsed() > eReadyTimeoutMs));
|
||||
}
|
||||
|
||||
cString cSatipDevice::DeviceType(void) const
|
||||
{
|
||||
//debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
debug8("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
return "SAT>IP";
|
||||
}
|
||||
|
||||
cString cSatipDevice::DeviceName(void) const
|
||||
{
|
||||
//debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
debug8("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
return deviceNameM;
|
||||
}
|
||||
|
||||
bool cSatipDevice::AvoidRecording(void) const
|
||||
{
|
||||
//debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
debug8("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
return SatipConfig.IsOperatingModeLow();
|
||||
}
|
||||
|
||||
int cSatipDevice::SignalStrength(void) const
|
||||
{
|
||||
//debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
debug8("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
return (pTunerM ? pTunerM->SignalStrength() : -1);
|
||||
}
|
||||
|
||||
int cSatipDevice::SignalQuality(void) const
|
||||
{
|
||||
//debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
debug8("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
return (pTunerM ? pTunerM->SignalQuality() : -1);
|
||||
}
|
||||
|
||||
bool cSatipDevice::ProvidesSource(int sourceP) const
|
||||
{
|
||||
//debug("%s(%c) [device %u]", __PRETTY_FUNCTION__, cSource::ToChar(sourceP), deviceIndexM);
|
||||
debug8("%s(%c) [device %u]", __PRETTY_FUNCTION__, cSource::ToChar(sourceP), deviceIndexM);
|
||||
if (!SatipConfig.IsOperatingModeOff() && !!cSatipDiscover::GetInstance()->GetServer(sourceP)) {
|
||||
int numDisabledSourcesM = SatipConfig.GetDisabledSourcesCount();
|
||||
for (int i = 0; i < numDisabledSourcesM; ++i) {
|
||||
@ -231,7 +231,7 @@ bool cSatipDevice::ProvidesSource(int sourceP) const
|
||||
|
||||
bool cSatipDevice::ProvidesTransponder(const cChannel *channelP) const
|
||||
{
|
||||
debug("%s(%d) transponder=%d source=%c [device %u]", __PRETTY_FUNCTION__, channelP ? channelP->Number() : -1, channelP ? channelP->Transponder() : -1, channelP ? cSource::ToChar(channelP->Source()) : '?', deviceIndexM);
|
||||
debug1("%s(%d) transponder=%d source=%c [device %u]", __PRETTY_FUNCTION__, channelP ? channelP->Number() : -1, channelP ? channelP->Transponder() : -1, channelP ? cSource::ToChar(channelP->Source()) : '?', deviceIndexM);
|
||||
return (ProvidesSource(channelP->Source()));
|
||||
}
|
||||
|
||||
@ -241,7 +241,7 @@ bool cSatipDevice::ProvidesChannel(const cChannel *channelP, int priorityP, bool
|
||||
bool hasPriority = (priorityP == IDLEPRIORITY) || (priorityP > this->Priority());
|
||||
bool needsDetachReceivers = false;
|
||||
|
||||
debug("%s(%d, %d, %d) [device %u]", __PRETTY_FUNCTION__, channelP ? channelP->Number() : -1, priorityP, !!needsDetachReceiversP, deviceIndexM);
|
||||
debug1("%s(%d, %d, %d) [device %u]", __PRETTY_FUNCTION__, channelP ? channelP->Number() : -1, priorityP, !!needsDetachReceiversP, deviceIndexM);
|
||||
|
||||
if (channelP && ProvidesTransponder(channelP)) {
|
||||
result = hasPriority;
|
||||
@ -323,7 +323,7 @@ bool cSatipDevice::SetChannelDevice(const cChannel *channelP, bool liveViewP)
|
||||
cString address;
|
||||
cSatipServer *server = cSatipDiscover::GetInstance()->GetServer(channelP->Source(), channelP->Transponder(), dtp.System());
|
||||
if (!server) {
|
||||
debug("%s No suitable server found [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
debug1("%s No suitable server found [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
return false;
|
||||
}
|
||||
cSatipDiscover::GetInstance()->SetTransponder(server, channelP->Transponder());
|
||||
@ -342,7 +342,7 @@ bool cSatipDevice::SetChannelDevice(const cChannel *channelP, bool liveViewP)
|
||||
|
||||
bool cSatipDevice::SetPid(cPidHandle *handleP, int typeP, bool onP)
|
||||
{
|
||||
//debug("%s(%d, %d, %d) [device %u]", __PRETTY_FUNCTION__, deviceIndexM, handleP->pid, typeP, onP, deviceIndexM);
|
||||
debug8("%s(%d, %d, %d) [device %u]", __PRETTY_FUNCTION__, handleP->pid, typeP, onP, deviceIndexM);
|
||||
if (pTunerM && handleP && handleP->pid >= 0) {
|
||||
if (onP)
|
||||
return pTunerM->SetPid(handleP->pid, typeP, true);
|
||||
@ -354,7 +354,7 @@ bool cSatipDevice::SetPid(cPidHandle *handleP, int typeP, bool onP)
|
||||
|
||||
int cSatipDevice::OpenFilter(u_short pidP, u_char tidP, u_char maskP)
|
||||
{
|
||||
//debug("%s(%d, %02X, %02X) [device %d]", __PRETTY_FUNCTION__, pidP, tidP, maskP, deviceIndexM);
|
||||
debug8("%s(%d, %02X, %02X) [device %d]", __PRETTY_FUNCTION__, pidP, tidP, maskP, deviceIndexM);
|
||||
if (pSectionFilterHandlerM) {
|
||||
int handle = pSectionFilterHandlerM->Open(pidP, tidP, maskP);
|
||||
if (pTunerM && (handle >= 0))
|
||||
@ -366,7 +366,7 @@ int cSatipDevice::OpenFilter(u_short pidP, u_char tidP, u_char maskP)
|
||||
|
||||
void cSatipDevice::CloseFilter(int handleP)
|
||||
{
|
||||
//debug("%s(%d) [device %u]", __PRETTY_FUNCTION__, handleP, deviceIndexM);
|
||||
debug8("%s(%d) [device %u]", __PRETTY_FUNCTION__, handleP, deviceIndexM);
|
||||
if (pSectionFilterHandlerM) {
|
||||
if (pTunerM)
|
||||
pTunerM->SetPid(pSectionFilterHandlerM->GetPid(handleP), ptOther, false);
|
||||
@ -376,7 +376,7 @@ void cSatipDevice::CloseFilter(int handleP)
|
||||
|
||||
bool cSatipDevice::OpenDvr(void)
|
||||
{
|
||||
debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
debug1("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
isPacketDeliveredM = false;
|
||||
tsBufferM->Clear();
|
||||
if (pTunerM)
|
||||
@ -387,7 +387,7 @@ bool cSatipDevice::OpenDvr(void)
|
||||
|
||||
void cSatipDevice::CloseDvr(void)
|
||||
{
|
||||
debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
debug1("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
if (pTunerM)
|
||||
pTunerM->Close();
|
||||
isOpenDvrM = false;
|
||||
@ -395,19 +395,19 @@ void cSatipDevice::CloseDvr(void)
|
||||
|
||||
bool cSatipDevice::HasLock(int timeoutMsP) const
|
||||
{
|
||||
//debug("%s(%d) [device %d]", __PRETTY_FUNCTION__, timeoutMsP, deviceIndexM);
|
||||
debug8("%s(%d) [device %d]", __PRETTY_FUNCTION__, timeoutMsP, deviceIndexM);
|
||||
return (pTunerM && pTunerM->HasLock());
|
||||
}
|
||||
|
||||
bool cSatipDevice::HasInternalCam(void)
|
||||
{
|
||||
//debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
debug8("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
return false;
|
||||
}
|
||||
|
||||
void cSatipDevice::WriteData(uchar *bufferP, int lengthP)
|
||||
{
|
||||
//debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
debug8("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
// Fill up TS buffer
|
||||
if (isOpenDvrM && tsBufferM) {
|
||||
int len = tsBufferM->Put(bufferP, lengthP);
|
||||
@ -421,13 +421,13 @@ void cSatipDevice::WriteData(uchar *bufferP, int lengthP)
|
||||
|
||||
int cSatipDevice::GetId(void)
|
||||
{
|
||||
//debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
debug8("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
return deviceIndexM;
|
||||
}
|
||||
|
||||
uchar *cSatipDevice::GetData(int *availableP)
|
||||
{
|
||||
//debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
debug8("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
if (isOpenDvrM && tsBufferM) {
|
||||
int count = 0;
|
||||
if (isPacketDeliveredM)
|
||||
@ -458,7 +458,7 @@ uchar *cSatipDevice::GetData(int *availableP)
|
||||
|
||||
void cSatipDevice::SkipData(int countP)
|
||||
{
|
||||
//debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
debug8("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
tsBufferM->Del(countP);
|
||||
isPacketDeliveredM = false;
|
||||
// Update buffer statistics
|
||||
@ -467,7 +467,7 @@ void cSatipDevice::SkipData(int countP)
|
||||
|
||||
bool cSatipDevice::GetTSPacket(uchar *&dataP)
|
||||
{
|
||||
//debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
debug8("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
if (tsBufferM) {
|
||||
#if defined(APIVERSNUM) && APIVERSNUM >= 20104
|
||||
if (cCamSlot *cs = CamSlot()) {
|
||||
|
52
discover.c
52
discover.c
@ -28,7 +28,7 @@ cSatipDiscover *cSatipDiscover::GetInstance(void)
|
||||
|
||||
bool cSatipDiscover::Initialize(cSatipDiscoverServers *serversP)
|
||||
{
|
||||
debug("%s", __PRETTY_FUNCTION__);
|
||||
debug1("%s", __PRETTY_FUNCTION__);
|
||||
if (instanceS) {
|
||||
if (serversP) {
|
||||
for (cSatipDiscoverServer *s = serversP->First(); s; s = serversP->Next(s))
|
||||
@ -42,7 +42,7 @@ bool cSatipDiscover::Initialize(cSatipDiscoverServers *serversP)
|
||||
|
||||
void cSatipDiscover::Destroy(void)
|
||||
{
|
||||
debug("%s", __PRETTY_FUNCTION__);
|
||||
debug1("%s", __PRETTY_FUNCTION__);
|
||||
if (instanceS)
|
||||
instanceS->Deactivate();
|
||||
}
|
||||
@ -51,7 +51,7 @@ size_t cSatipDiscover::WriteCallback(char *ptrP, size_t sizeP, size_t nmembP, vo
|
||||
{
|
||||
cSatipDiscover *obj = reinterpret_cast<cSatipDiscover *>(dataP);
|
||||
size_t len = sizeP * nmembP;
|
||||
//debug("%s len=%zu", __PRETTY_FUNCTION__, len);
|
||||
debug8("%s len=%zu", __PRETTY_FUNCTION__, len);
|
||||
|
||||
if (obj) {
|
||||
CURLcode res = CURLE_OK;
|
||||
@ -95,19 +95,19 @@ int cSatipDiscover::DebugCallback(CURL *handleP, curl_infotype typeP, char *data
|
||||
if (obj) {
|
||||
switch (typeP) {
|
||||
case CURLINFO_TEXT:
|
||||
extra("%s HTTP INFO %.*s", __PRETTY_FUNCTION__, (int)sizeP, dataP);
|
||||
debug2("%s HTTP INFO %.*s", __PRETTY_FUNCTION__, (int)sizeP, dataP);
|
||||
break;
|
||||
case CURLINFO_HEADER_IN:
|
||||
extra("%s HTTP HEAD <<< %.*s", __PRETTY_FUNCTION__, (int)sizeP, dataP);
|
||||
debug2("%s HTTP HEAD <<< %.*s", __PRETTY_FUNCTION__, (int)sizeP, dataP);
|
||||
break;
|
||||
case CURLINFO_HEADER_OUT:
|
||||
extra("%s HTTP HEAD >>>\n%.*s", __PRETTY_FUNCTION__, (int)sizeP, dataP);
|
||||
debug2("%s HTTP HEAD >>>\n%.*s", __PRETTY_FUNCTION__, (int)sizeP, dataP);
|
||||
break;
|
||||
case CURLINFO_DATA_IN:
|
||||
extra("%s HTTP DATA <<< %.*s", __PRETTY_FUNCTION__, (int)sizeP, dataP);
|
||||
debug2("%s HTTP DATA <<< %.*s", __PRETTY_FUNCTION__, (int)sizeP, dataP);
|
||||
break;
|
||||
case CURLINFO_DATA_OUT:
|
||||
extra("%s HTTP DATA >>>\n%.*s", __PRETTY_FUNCTION__, (int)sizeP, dataP);
|
||||
debug2("%s HTTP DATA >>>\n%.*s", __PRETTY_FUNCTION__, (int)sizeP, dataP);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -127,12 +127,12 @@ cSatipDiscover::cSatipDiscover()
|
||||
probeIntervalM(0),
|
||||
serversM()
|
||||
{
|
||||
debug("%s", __PRETTY_FUNCTION__);
|
||||
debug1("%s", __PRETTY_FUNCTION__);
|
||||
}
|
||||
|
||||
cSatipDiscover::~cSatipDiscover()
|
||||
{
|
||||
debug("%s", __PRETTY_FUNCTION__);
|
||||
debug1("%s", __PRETTY_FUNCTION__);
|
||||
Deactivate();
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
// Free allocated memory
|
||||
@ -150,7 +150,7 @@ void cSatipDiscover::Activate(void)
|
||||
|
||||
void cSatipDiscover::Deactivate(void)
|
||||
{
|
||||
debug("%s", __PRETTY_FUNCTION__);
|
||||
debug1("%s", __PRETTY_FUNCTION__);
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
sleepM.Signal();
|
||||
if (Running())
|
||||
@ -159,7 +159,7 @@ void cSatipDiscover::Deactivate(void)
|
||||
|
||||
void cSatipDiscover::Action(void)
|
||||
{
|
||||
debug("%s Entering", __PRETTY_FUNCTION__);
|
||||
debug1("%s Entering", __PRETTY_FUNCTION__);
|
||||
probeIntervalM.Set(eProbeIntervalMs);
|
||||
msearchM.Probe();
|
||||
// Do the thread loop
|
||||
@ -188,18 +188,18 @@ void cSatipDiscover::Action(void)
|
||||
// to avoid busy loop and reduce cpu load
|
||||
sleepM.Wait(eSleepTimeoutMs);
|
||||
}
|
||||
debug("%s Exiting", __PRETTY_FUNCTION__);
|
||||
debug1("%s Exiting", __PRETTY_FUNCTION__);
|
||||
}
|
||||
|
||||
void cSatipDiscover::Fetch(const char *urlP)
|
||||
{
|
||||
debug("%s(%s)", __PRETTY_FUNCTION__, urlP);
|
||||
debug1("%s(%s)", __PRETTY_FUNCTION__, urlP);
|
||||
if (handleM && !isempty(urlP)) {
|
||||
long rc = 0;
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
// Verbose output
|
||||
if (SatipConfig.IsLoggingExtra()) {
|
||||
if (SatipConfig.IsLoggingDebug2()) {
|
||||
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_VERBOSE, 1L);
|
||||
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_DEBUGFUNCTION, cSatipDiscover::DebugCallback);
|
||||
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_DEBUGDATA, this);
|
||||
@ -233,7 +233,7 @@ void cSatipDiscover::Fetch(const char *urlP)
|
||||
|
||||
void cSatipDiscover::AddServer(const char *addrP, const char *modelP, const char * descP)
|
||||
{
|
||||
debug("%s(%s, %s, %s)", __PRETTY_FUNCTION__, addrP, modelP, descP);
|
||||
debug1("%s(%s, %s, %s)", __PRETTY_FUNCTION__, addrP, modelP, descP);
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
cSatipServer *tmp = new cSatipServer(addrP, modelP, descP);
|
||||
// Validate against existing servers
|
||||
@ -247,70 +247,70 @@ void cSatipDiscover::AddServer(const char *addrP, const char *modelP, const char
|
||||
|
||||
int cSatipDiscover::GetServerCount(void)
|
||||
{
|
||||
//debug("%s", __PRETTY_FUNCTION__);
|
||||
debug8("%s", __PRETTY_FUNCTION__);
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
return serversM.Count();
|
||||
}
|
||||
|
||||
cSatipServer *cSatipDiscover::GetServer(int sourceP, int transponderP, int systemP)
|
||||
{
|
||||
//debug("%s(%d, %d, %d)", __PRETTY_FUNCTION__, sourceP, transponderP, systemP);
|
||||
debug8("%s(%d, %d, %d)", __PRETTY_FUNCTION__, sourceP, transponderP, systemP);
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
return serversM.Find(sourceP, transponderP, systemP);
|
||||
}
|
||||
|
||||
cSatipServer *cSatipDiscover::GetServer(cSatipServer *serverP)
|
||||
{
|
||||
//debug("%s", __PRETTY_FUNCTION__);
|
||||
debug8("%s", __PRETTY_FUNCTION__);
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
return serversM.Find(serverP);
|
||||
}
|
||||
|
||||
cSatipServers *cSatipDiscover::GetServers(void)
|
||||
{
|
||||
//debug("%s", __PRETTY_FUNCTION__);
|
||||
debug8("%s", __PRETTY_FUNCTION__);
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
return &serversM;
|
||||
}
|
||||
|
||||
cString cSatipDiscover::GetServerString(cSatipServer *serverP)
|
||||
{
|
||||
//debug("%s", __PRETTY_FUNCTION__);
|
||||
debug8("%s", __PRETTY_FUNCTION__);
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
return serversM.GetString(serverP);
|
||||
}
|
||||
|
||||
cString cSatipDiscover::GetServerList(void)
|
||||
{
|
||||
//debug("%s", __PRETTY_FUNCTION__);
|
||||
debug8("%s", __PRETTY_FUNCTION__);
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
return serversM.List();
|
||||
}
|
||||
|
||||
void cSatipDiscover::SetTransponder(cSatipServer *serverP, int transponderP)
|
||||
{
|
||||
//debug("%s(, %d)", __PRETTY_FUNCTION__, transponderP);
|
||||
debug8("%s(, %d)", __PRETTY_FUNCTION__, transponderP);
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
serversM.SetTransponder(serverP, transponderP);
|
||||
}
|
||||
|
||||
void cSatipDiscover::UseServer(cSatipServer *serverP, bool onOffP)
|
||||
{
|
||||
//debug("%s(, %d)", __PRETTY_FUNCTION__, onOffP);
|
||||
debug8("%s(, %d)", __PRETTY_FUNCTION__, onOffP);
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
serversM.Use(serverP, onOffP);
|
||||
}
|
||||
|
||||
int cSatipDiscover::NumProvidedSystems(void)
|
||||
{
|
||||
//debug("%s", __PRETTY_FUNCTION__);
|
||||
debug8("%s", __PRETTY_FUNCTION__);
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
return serversM.NumProvidedSystems();
|
||||
}
|
||||
|
||||
void cSatipDiscover::SetUrl(const char *urlP)
|
||||
{
|
||||
//debug("%s(%s)", __PRETTY_FUNCTION__, urlP);
|
||||
debug8("%s(%s)", __PRETTY_FUNCTION__, urlP);
|
||||
mutexM.Lock();
|
||||
probeUrlListM.Insert(strdup(urlP));
|
||||
mutexM.Unlock();
|
||||
|
10
log.h
10
log.h
@ -12,8 +12,14 @@
|
||||
|
||||
#define error(x...) esyslog("SATIP-ERROR: " x)
|
||||
#define info(x...) isyslog("SATIP: " x)
|
||||
#define debug(x...) void( SatipConfig.IsLoggingDebug() ? dsyslog("SATIP: " x) : void() )
|
||||
#define extra(x...) void( SatipConfig.IsLoggingExtra() ? dsyslog("SATIP: " x) : void() )
|
||||
#define debug1(x...) void( SatipConfig.IsLoggingDebug1() ? dsyslog("SATIP: " x) : void() )
|
||||
#define debug2(x...) void( SatipConfig.IsLoggingDebug2() ? dsyslog("SATIP: " x) : void() )
|
||||
#define debug3(x...) void( SatipConfig.IsLoggingDebug3() ? dsyslog("SATIP: " x) : void() )
|
||||
#define debug4(x...) void( SatipConfig.IsLoggingDebug4() ? dsyslog("SATIP: " x) : void() )
|
||||
#define debug5(x...) void( SatipConfig.IsLoggingDebug5() ? dsyslog("SATIP: " x) : void() )
|
||||
#define debug6(x...) void( SatipConfig.IsLoggingDebug6() ? dsyslog("SATIP: " x) : void() )
|
||||
#define debug7(x...) void( SatipConfig.IsLoggingDebug7() ? dsyslog("SATIP: " x) : void() )
|
||||
#define debug8(x...) void( SatipConfig.IsLoggingDebug8() ? dsyslog("SATIP: " x) : void() )
|
||||
|
||||
#endif // __SATIP_LOG_H
|
||||
|
||||
|
12
msearch.c
12
msearch.c
@ -39,7 +39,7 @@ cSatipMsearch::~cSatipMsearch()
|
||||
|
||||
void cSatipMsearch::Probe(void)
|
||||
{
|
||||
debug("%s", __PRETTY_FUNCTION__);
|
||||
debug1("%s", __PRETTY_FUNCTION__);
|
||||
if (!registeredM) {
|
||||
cSatipPoller::GetInstance()->Register(*this);
|
||||
registeredM = true;
|
||||
@ -54,17 +54,17 @@ int cSatipMsearch::GetFd(void)
|
||||
|
||||
void cSatipMsearch::Process(void)
|
||||
{
|
||||
//debug("%s", __PRETTY_FUNCTION__);
|
||||
debug8("%s", __PRETTY_FUNCTION__);
|
||||
if (bufferM) {
|
||||
int length;
|
||||
while ((length = Read(bufferM, bufferLenM)) > 0) {
|
||||
bufferM[min(length, int(bufferLenM - 1))] = 0;
|
||||
//debug("%s len=%d buf=%s", __PRETTY_FUNCTION__, length, bufferM);
|
||||
debug3("%s len=%d buf=%s", __PRETTY_FUNCTION__, length, bufferM);
|
||||
bool status = false, valid = false;
|
||||
char *s, *p = reinterpret_cast<char *>(bufferM), *location = NULL;
|
||||
char *r = strtok_r(p, "\r\n", &s);
|
||||
while (r) {
|
||||
//debug("%s r=%s", __PRETTY_FUNCTION__, r);
|
||||
debug3("%s r=%s", __PRETTY_FUNCTION__, r);
|
||||
// Check the status code
|
||||
// HTTP/1.1 200 OK
|
||||
if (!status && startswith(r, "HTTP/1.1 200 OK"))
|
||||
@ -74,7 +74,7 @@ void cSatipMsearch::Process(void)
|
||||
// LOCATION: http://192.168.0.115:8888/octonet.xml
|
||||
if (startswith(r, "LOCATION:")) {
|
||||
location = compactspace(r + 9);
|
||||
debug("%s location='%s'", __PRETTY_FUNCTION__, location);
|
||||
debug1("%s location='%s'", __PRETTY_FUNCTION__, location);
|
||||
}
|
||||
// Check the source type
|
||||
// ST: urn:ses-com:device:SatIPServer:1
|
||||
@ -82,7 +82,7 @@ void cSatipMsearch::Process(void)
|
||||
char *st = compactspace(r + 3);
|
||||
if (strstr(st, "urn:ses-com:device:SatIPServer:1"))
|
||||
valid = true;
|
||||
debug("%s st='%s'", __PRETTY_FUNCTION__, st);
|
||||
debug1("%s st='%s'", __PRETTY_FUNCTION__, st);
|
||||
}
|
||||
// Check whether all the required data is found
|
||||
if (valid && !isempty(location)) {
|
||||
|
24
poller.c
24
poller.c
@ -25,7 +25,7 @@ cSatipPoller *cSatipPoller::GetInstance(void)
|
||||
|
||||
bool cSatipPoller::Initialize(void)
|
||||
{
|
||||
debug("%s", __PRETTY_FUNCTION__);
|
||||
debug1("%s", __PRETTY_FUNCTION__);
|
||||
if (instanceS)
|
||||
instanceS->Activate();
|
||||
return true;
|
||||
@ -33,7 +33,7 @@ bool cSatipPoller::Initialize(void)
|
||||
|
||||
void cSatipPoller::Destroy(void)
|
||||
{
|
||||
debug("%s", __PRETTY_FUNCTION__);
|
||||
debug1("%s", __PRETTY_FUNCTION__);
|
||||
if (instanceS)
|
||||
instanceS->Deactivate();
|
||||
}
|
||||
@ -43,12 +43,12 @@ cSatipPoller::cSatipPoller()
|
||||
mutexM(),
|
||||
fdM(epoll_create(eMaxFileDescriptors))
|
||||
{
|
||||
debug("%s", __PRETTY_FUNCTION__);
|
||||
debug1("%s", __PRETTY_FUNCTION__);
|
||||
}
|
||||
|
||||
cSatipPoller::~cSatipPoller()
|
||||
{
|
||||
debug("%s", __PRETTY_FUNCTION__);
|
||||
debug1("%s", __PRETTY_FUNCTION__);
|
||||
Deactivate();
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
close(fdM);
|
||||
@ -63,7 +63,7 @@ void cSatipPoller::Activate(void)
|
||||
|
||||
void cSatipPoller::Deactivate(void)
|
||||
{
|
||||
debug("%s", __PRETTY_FUNCTION__);
|
||||
debug1("%s", __PRETTY_FUNCTION__);
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
if (Running())
|
||||
Cancel(3);
|
||||
@ -71,7 +71,7 @@ void cSatipPoller::Deactivate(void)
|
||||
|
||||
void cSatipPoller::Action(void)
|
||||
{
|
||||
debug("%s Entering", __PRETTY_FUNCTION__);
|
||||
debug1("%s Entering", __PRETTY_FUNCTION__);
|
||||
struct epoll_event events[eMaxFileDescriptors];
|
||||
uint64_t maxElapsed = 0;
|
||||
// Increase priority
|
||||
@ -89,34 +89,34 @@ void cSatipPoller::Action(void)
|
||||
elapsed = processing.Elapsed();
|
||||
if (elapsed > maxElapsed) {
|
||||
maxElapsed = elapsed;
|
||||
debug("%s Processing %s took %" PRIu64 " ms", __PRETTY_FUNCTION__, *(poll->ToString()), maxElapsed);
|
||||
debug1("%s Processing %s took %" PRIu64 " ms", __PRETTY_FUNCTION__, *(poll->ToString()), maxElapsed);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
debug("%s Exiting", __PRETTY_FUNCTION__);
|
||||
debug1("%s Exiting", __PRETTY_FUNCTION__);
|
||||
}
|
||||
|
||||
bool cSatipPoller::Register(cSatipPollerIf &pollerP)
|
||||
{
|
||||
debug("%s fd=%d", __PRETTY_FUNCTION__, pollerP.GetFd());
|
||||
debug1("%s fd=%d", __PRETTY_FUNCTION__, pollerP.GetFd());
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
|
||||
struct epoll_event ev;
|
||||
ev.events = EPOLLIN | EPOLLET;
|
||||
ev.data.ptr = &pollerP;
|
||||
ERROR_IF_RET(epoll_ctl(fdM, EPOLL_CTL_ADD, pollerP.GetFd(), &ev) == -1, "epoll_ctl(EPOLL_CTL_ADD) failed", return false);
|
||||
debug("%s Added interface fd=%d", __PRETTY_FUNCTION__, pollerP.GetFd());
|
||||
debug1("%s Added interface fd=%d", __PRETTY_FUNCTION__, pollerP.GetFd());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cSatipPoller::Unregister(cSatipPollerIf &pollerP)
|
||||
{
|
||||
debug("%s fd=%d", __PRETTY_FUNCTION__, pollerP.GetFd());
|
||||
debug1("%s fd=%d", __PRETTY_FUNCTION__, pollerP.GetFd());
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
ERROR_IF_RET((epoll_ctl(fdM, EPOLL_CTL_DEL, pollerP.GetFd(), NULL) == -1), "epoll_ctl(EPOLL_CTL_DEL) failed", return false);
|
||||
debug("%s Removed interface fd=%d", __PRETTY_FUNCTION__, pollerP.GetFd());
|
||||
debug1("%s Removed interface fd=%d", __PRETTY_FUNCTION__, pollerP.GetFd());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
10
rtcp.c
10
rtcp.c
@ -15,7 +15,7 @@ cSatipRtcp::cSatipRtcp(cSatipTunerIf &tunerP, unsigned int bufferLenP)
|
||||
bufferLenM(bufferLenP),
|
||||
bufferM(MALLOC(unsigned char, bufferLenM))
|
||||
{
|
||||
debug("%s(, %u) [device %d]", __PRETTY_FUNCTION__, bufferLenP, tunerM.GetId());
|
||||
debug1("%s(, %u) [device %d]", __PRETTY_FUNCTION__, bufferLenP, tunerM.GetId());
|
||||
if (bufferM)
|
||||
memset(bufferM, 0, bufferLenM);
|
||||
else
|
||||
@ -24,19 +24,19 @@ cSatipRtcp::cSatipRtcp(cSatipTunerIf &tunerP, unsigned int bufferLenP)
|
||||
|
||||
cSatipRtcp::~cSatipRtcp()
|
||||
{
|
||||
debug("%s [device %d]", __PRETTY_FUNCTION__, tunerM.GetId());
|
||||
debug1("%s [device %d]", __PRETTY_FUNCTION__, tunerM.GetId());
|
||||
DELETE_POINTER(bufferM);
|
||||
}
|
||||
|
||||
int cSatipRtcp::GetFd(void)
|
||||
{
|
||||
//debug("%s [device %d]", __PRETTY_FUNCTION__, tunerM.GetId());
|
||||
debug8("%s [device %d]", __PRETTY_FUNCTION__, tunerM.GetId());
|
||||
return Fd();
|
||||
}
|
||||
|
||||
int cSatipRtcp::GetApplicationOffset(int *lengthP)
|
||||
{
|
||||
//debug("%s(%d) [device %d]", __PRETTY_FUNCTION__, *lengthP, tunerM.GetId());
|
||||
debug8("%s(%d) [device %d]", __PRETTY_FUNCTION__, *lengthP, tunerM.GetId());
|
||||
if (!lengthP)
|
||||
return -1;
|
||||
int offset = 0;
|
||||
@ -81,7 +81,7 @@ int cSatipRtcp::GetApplicationOffset(int *lengthP)
|
||||
|
||||
void cSatipRtcp::Process(void)
|
||||
{
|
||||
//debug("%s [device %d]", __PRETTY_FUNCTION__, tunerM.GetId());
|
||||
debug8("%s [device %d]", __PRETTY_FUNCTION__, tunerM.GetId());
|
||||
if (bufferM) {
|
||||
int length;
|
||||
while ((length = Read(bufferM, bufferLenM)) > 0) {
|
||||
|
14
rtp.c
14
rtp.c
@ -18,7 +18,7 @@ cSatipRtp::cSatipRtp(cSatipTunerIf &tunerP, unsigned int bufferLenP)
|
||||
packetErrorsM(0),
|
||||
sequenceNumberM(-1)
|
||||
{
|
||||
debug("%s(, %u) [device %d]", __PRETTY_FUNCTION__, bufferLenP, tunerM.GetId());
|
||||
debug1("%s(, %u) [device %d]", __PRETTY_FUNCTION__, bufferLenP, tunerM.GetId());
|
||||
if (bufferM)
|
||||
memset(bufferM, 0, bufferLenM);
|
||||
else
|
||||
@ -27,7 +27,7 @@ cSatipRtp::cSatipRtp(cSatipTunerIf &tunerP, unsigned int bufferLenP)
|
||||
|
||||
cSatipRtp::~cSatipRtp()
|
||||
{
|
||||
debug("%s [device %d]", __PRETTY_FUNCTION__, tunerM.GetId());
|
||||
debug1("%s [device %d]", __PRETTY_FUNCTION__, tunerM.GetId());
|
||||
DELETE_POINTER(bufferM);
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ int cSatipRtp::GetFd(void)
|
||||
|
||||
void cSatipRtp::Close(void)
|
||||
{
|
||||
debug("%s [device %d]", __PRETTY_FUNCTION__, tunerM.GetId());
|
||||
debug1("%s [device %d]", __PRETTY_FUNCTION__, tunerM.GetId());
|
||||
|
||||
cSatipSocket::Close();
|
||||
|
||||
@ -52,7 +52,7 @@ void cSatipRtp::Close(void)
|
||||
|
||||
int cSatipRtp::GetHeaderLenght(unsigned int lengthP)
|
||||
{
|
||||
//debug("%s(%d) [device %d]", __PRETTY_FUNCTION__, lengthP, tunerM.GetId());
|
||||
debug8("%s(%d) [device %d]", __PRETTY_FUNCTION__, lengthP, tunerM.GetId());
|
||||
unsigned int headerlen = 0;
|
||||
|
||||
if (lengthP > 0) {
|
||||
@ -95,12 +95,12 @@ int cSatipRtp::GetHeaderLenght(unsigned int lengthP)
|
||||
}
|
||||
// Check for empty payload
|
||||
if (lengthP == headerlen) {
|
||||
debug("%s(%d) Received empty RTP packet #%d [device %d]", __PRETTY_FUNCTION__, lengthP, seq, tunerM.GetId());
|
||||
debug1("%s(%d) Received empty RTP packet #%d [device %d]", __PRETTY_FUNCTION__, lengthP, seq, tunerM.GetId());
|
||||
headerlen = -1;
|
||||
}
|
||||
// Check that rtp is version 2 and payload contains multiple of TS packet data
|
||||
else if ((v != 2) || (((lengthP - headerlen) % TS_SIZE) != 0) || (bufferM[headerlen] != TS_SYNC_BYTE)) {
|
||||
debug("%s(%d) Received incorrect RTP packet #%d v=%d len=%d sync=0x%02X [device %d]", __PRETTY_FUNCTION__, lengthP, seq, v, headerlen, bufferM[headerlen], tunerM.GetId());
|
||||
debug1("%s(%d) Received incorrect RTP packet #%d v=%d len=%d sync=0x%02X [device %d]", __PRETTY_FUNCTION__, lengthP, seq, v, headerlen, bufferM[headerlen], tunerM.GetId());
|
||||
headerlen = -1;
|
||||
}
|
||||
}
|
||||
@ -111,7 +111,7 @@ int cSatipRtp::GetHeaderLenght(unsigned int lengthP)
|
||||
|
||||
void cSatipRtp::Process(void)
|
||||
{
|
||||
//debug("%s [device %d]", __PRETTY_FUNCTION__, tunerM.GetId());
|
||||
debug8("%s [device %d]", __PRETTY_FUNCTION__, tunerM.GetId());
|
||||
if (bufferM) {
|
||||
int length;
|
||||
while ((length = Read(bufferM, bufferLenM)) > 0) {
|
||||
|
40
rtsp.c
40
rtsp.c
@ -15,13 +15,13 @@ cSatipRtsp::cSatipRtsp(cSatipTunerIf &tunerP)
|
||||
handleM(curl_easy_init()),
|
||||
headerListM(NULL)
|
||||
{
|
||||
debug("%s [device %d]", __PRETTY_FUNCTION__, tunerM.GetId());
|
||||
debug1("%s [device %d]", __PRETTY_FUNCTION__, tunerM.GetId());
|
||||
|
||||
if (handleM) {
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
// Verbose output
|
||||
if (SatipConfig.IsLoggingExtra()) {
|
||||
if (SatipConfig.IsLoggingDebug2()) {
|
||||
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_VERBOSE, 1L);
|
||||
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_DEBUGFUNCTION, cSatipRtsp::DebugCallback);
|
||||
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_DEBUGDATA, this);
|
||||
@ -42,7 +42,7 @@ cSatipRtsp::cSatipRtsp(cSatipTunerIf &tunerP)
|
||||
|
||||
cSatipRtsp::~cSatipRtsp()
|
||||
{
|
||||
debug("%s [device %d]", __PRETTY_FUNCTION__, tunerM.GetId());
|
||||
debug1("%s [device %d]", __PRETTY_FUNCTION__, tunerM.GetId());
|
||||
|
||||
if (handleM) {
|
||||
// Cleanup curl stuff
|
||||
@ -59,13 +59,13 @@ size_t cSatipRtsp::HeaderCallback(void *ptrP, size_t sizeP, size_t nmembP, void
|
||||
{
|
||||
cSatipRtsp *obj = reinterpret_cast<cSatipRtsp *>(dataP);
|
||||
size_t len = sizeP * nmembP;
|
||||
//debug("%s len=%zu", __PRETTY_FUNCTION__, len);
|
||||
debug8("%s len=%zu", __PRETTY_FUNCTION__, len);
|
||||
|
||||
char *s, *p = (char *)ptrP;
|
||||
char *r = strtok_r(p, "\r\n", &s);
|
||||
|
||||
while (obj && r) {
|
||||
//debug("%s(%zu): %s", __PRETTY_FUNCTION__, len, r);
|
||||
debug8("%s(%zu): %s", __PRETTY_FUNCTION__, len, r);
|
||||
r = skipspace(r);
|
||||
if (strstr(r, "com.ses.streamID")) {
|
||||
int streamid = -1;
|
||||
@ -91,7 +91,7 @@ size_t cSatipRtsp::WriteCallback(void *ptrP, size_t sizeP, size_t nmembP, void *
|
||||
{
|
||||
cSatipRtsp *obj = reinterpret_cast<cSatipRtsp *>(dataP);
|
||||
size_t len = sizeP * nmembP;
|
||||
//debug("%s len=%zu", __PRETTY_FUNCTION__, len);
|
||||
debug8("%s len=%zu", __PRETTY_FUNCTION__, len);
|
||||
|
||||
if (obj && (len > 0))
|
||||
obj->tunerM.ProcessApplicationData((u_char*)ptrP, len);
|
||||
@ -106,19 +106,19 @@ int cSatipRtsp::DebugCallback(CURL *handleP, curl_infotype typeP, char *dataP, s
|
||||
if (obj) {
|
||||
switch (typeP) {
|
||||
case CURLINFO_TEXT:
|
||||
extra("%s [device %d] RTSP INFO %.*s", __PRETTY_FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP);
|
||||
debug2("%s [device %d] RTSP INFO %.*s", __PRETTY_FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP);
|
||||
break;
|
||||
case CURLINFO_HEADER_IN:
|
||||
extra("%s [device %d] RTSP HEAD <<< %.*s", __PRETTY_FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP);
|
||||
debug2("%s [device %d] RTSP HEAD <<< %.*s", __PRETTY_FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP);
|
||||
break;
|
||||
case CURLINFO_HEADER_OUT:
|
||||
extra("%s [device %d] RTSP HEAD >>>\n%.*s", __PRETTY_FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP);
|
||||
debug2("%s [device %d] RTSP HEAD >>>\n%.*s", __PRETTY_FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP);
|
||||
break;
|
||||
case CURLINFO_DATA_IN:
|
||||
extra("%s [device %d] RTSP DATA <<< %.*s", __PRETTY_FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP);
|
||||
debug2("%s [device %d] RTSP DATA <<< %.*s", __PRETTY_FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP);
|
||||
break;
|
||||
case CURLINFO_DATA_OUT:
|
||||
extra("%s [device %d] RTSP DATA >>>\n%.*s", __PRETTY_FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP);
|
||||
debug2("%s [device %d] RTSP DATA >>>\n%.*s", __PRETTY_FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -130,7 +130,7 @@ int cSatipRtsp::DebugCallback(CURL *handleP, curl_infotype typeP, char *dataP, s
|
||||
|
||||
cString cSatipRtsp::RtspUnescapeString(const char *strP)
|
||||
{
|
||||
debug("%s(%s) [device %d]", __PRETTY_FUNCTION__, strP, tunerM.GetId());
|
||||
debug1("%s(%s) [device %d]", __PRETTY_FUNCTION__, strP, tunerM.GetId());
|
||||
if (handleM) {
|
||||
char *p = curl_easy_unescape(handleM, strP, 0, NULL);
|
||||
cString s = p;
|
||||
@ -144,7 +144,7 @@ cString cSatipRtsp::RtspUnescapeString(const char *strP)
|
||||
|
||||
bool cSatipRtsp::Options(const char *uriP)
|
||||
{
|
||||
debug("%s(%s) [device %d]", __PRETTY_FUNCTION__, uriP, tunerM.GetId());
|
||||
debug1("%s(%s) [device %d]", __PRETTY_FUNCTION__, uriP, tunerM.GetId());
|
||||
if (handleM && !isempty(uriP)) {
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
@ -162,7 +162,7 @@ bool cSatipRtsp::Options(const char *uriP)
|
||||
|
||||
bool cSatipRtsp::Setup(const char *uriP, int rtpPortP, int rtcpPortP)
|
||||
{
|
||||
debug("%s(%s, %d, %d) [device %d]", __PRETTY_FUNCTION__, uriP, rtpPortP, rtcpPortP, tunerM.GetId());
|
||||
debug1("%s(%s, %d, %d) [device %d]", __PRETTY_FUNCTION__, uriP, rtpPortP, rtcpPortP, tunerM.GetId());
|
||||
if (handleM && !isempty(uriP)) {
|
||||
CURLcode res = CURLE_OK;
|
||||
cString transport = cString::sprintf("RTP/AVP;unicast;client_port=%d-%d", rtpPortP, rtcpPortP);
|
||||
@ -187,11 +187,11 @@ bool cSatipRtsp::Setup(const char *uriP, int rtpPortP, int rtcpPortP)
|
||||
|
||||
bool cSatipRtsp::SetSession(const char *sessionP)
|
||||
{
|
||||
debug("%s(%s) [device %d]", __PRETTY_FUNCTION__, sessionP, tunerM.GetId());
|
||||
debug1("%s(%s) [device %d]", __PRETTY_FUNCTION__, sessionP, tunerM.GetId());
|
||||
if (handleM) {
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
debug("%s: session id quirk enabled [device %d]", __PRETTY_FUNCTION__, tunerM.GetId());
|
||||
debug1("%s: session id quirk enabled [device %d]", __PRETTY_FUNCTION__, tunerM.GetId());
|
||||
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_RTSP_SESSION_ID, sessionP);
|
||||
}
|
||||
|
||||
@ -200,7 +200,7 @@ bool cSatipRtsp::SetSession(const char *sessionP)
|
||||
|
||||
bool cSatipRtsp::Describe(const char *uriP)
|
||||
{
|
||||
debug("%s(%s) [device %d]", __PRETTY_FUNCTION__, uriP, tunerM.GetId());
|
||||
debug1("%s(%s) [device %d]", __PRETTY_FUNCTION__, uriP, tunerM.GetId());
|
||||
if (handleM && !isempty(uriP)) {
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
@ -220,7 +220,7 @@ bool cSatipRtsp::Describe(const char *uriP)
|
||||
|
||||
bool cSatipRtsp::Play(const char *uriP)
|
||||
{
|
||||
debug("%s(%s) [device %d]", __PRETTY_FUNCTION__, uriP, tunerM.GetId());
|
||||
debug1("%s(%s) [device %d]", __PRETTY_FUNCTION__, uriP, tunerM.GetId());
|
||||
if (handleM && !isempty(uriP)) {
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
@ -236,7 +236,7 @@ bool cSatipRtsp::Play(const char *uriP)
|
||||
|
||||
bool cSatipRtsp::Teardown(const char *uriP)
|
||||
{
|
||||
debug("%s(%s) [device %d]", __PRETTY_FUNCTION__, uriP, tunerM.GetId());
|
||||
debug1("%s(%s) [device %d]", __PRETTY_FUNCTION__, uriP, tunerM.GetId());
|
||||
if (handleM && !isempty(uriP)) {
|
||||
CURLcode res = CURLE_OK;
|
||||
|
||||
@ -268,7 +268,7 @@ bool cSatipRtsp::ValidateLatestResponse(void)
|
||||
error("Detected invalid status code %ld: %s [device %d]", rc, url, tunerM.GetId());
|
||||
}
|
||||
}
|
||||
debug("%s result=%s [device %d]", __PRETTY_FUNCTION__, result ? "ok" : "failed", tunerM.GetId());
|
||||
debug1("%s result=%s [device %d]", __PRETTY_FUNCTION__, result ? "ok" : "failed", tunerM.GetId());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
50
satip.c
50
satip.c
@ -64,7 +64,7 @@ cPluginSatip::cPluginSatip(void)
|
||||
: deviceCountM(1),
|
||||
serversM(NULL)
|
||||
{
|
||||
//debug("%s", __PRETTY_FUNCTION__);
|
||||
debug8("%s", __PRETTY_FUNCTION__);
|
||||
// Initialize any member variables here.
|
||||
// DON'T DO ANYTHING ELSE THAT MAY HAVE SIDE EFFECTS, REQUIRE GLOBAL
|
||||
// VDR OBJECTS TO EXIST OR PRODUCE ANY OUTPUT!
|
||||
@ -72,13 +72,13 @@ cPluginSatip::cPluginSatip(void)
|
||||
|
||||
cPluginSatip::~cPluginSatip()
|
||||
{
|
||||
//debug("%s", __PRETTY_FUNCTION__);
|
||||
debug8("%s", __PRETTY_FUNCTION__);
|
||||
// Clean up after yourself!
|
||||
}
|
||||
|
||||
const char *cPluginSatip::CommandLineHelp(void)
|
||||
{
|
||||
debug("%s", __PRETTY_FUNCTION__);
|
||||
debug1("%s", __PRETTY_FUNCTION__);
|
||||
// Return a string that describes all known command line options.
|
||||
return " -d <num>, --devices=<number> set number of devices to be created\n"
|
||||
" -s <ipaddr>|<model>|<desc>, --server=<ipaddr1>|<model1>|<desc1>;<ipaddr2>|<model2>|<desc2>\n"
|
||||
@ -87,7 +87,7 @@ const char *cPluginSatip::CommandLineHelp(void)
|
||||
|
||||
bool cPluginSatip::ProcessArgs(int argc, char *argv[])
|
||||
{
|
||||
debug("%s", __PRETTY_FUNCTION__);
|
||||
debug1("%s", __PRETTY_FUNCTION__);
|
||||
// Implement command line argument processing here if applicable.
|
||||
static const struct option long_options[] = {
|
||||
{ "devices", required_argument, NULL, 'd' },
|
||||
@ -117,7 +117,7 @@ bool cPluginSatip::ProcessArgs(int argc, char *argv[])
|
||||
|
||||
bool cPluginSatip::Initialize(void)
|
||||
{
|
||||
debug("%s", __PRETTY_FUNCTION__);
|
||||
debug1("%s", __PRETTY_FUNCTION__);
|
||||
// Initialize any background activities the plugin shall perform.
|
||||
if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK)
|
||||
error("Unable to initialize CURL");
|
||||
@ -129,7 +129,7 @@ bool cPluginSatip::Initialize(void)
|
||||
|
||||
bool cPluginSatip::Start(void)
|
||||
{
|
||||
debug("%s", __PRETTY_FUNCTION__);
|
||||
debug1("%s", __PRETTY_FUNCTION__);
|
||||
// Start any background activities the plugin shall perform.
|
||||
curl_version_info_data *data = curl_version_info(CURLVERSION_NOW);
|
||||
cString info = cString::sprintf("Using CURL %s", data->version);
|
||||
@ -144,7 +144,7 @@ bool cPluginSatip::Start(void)
|
||||
|
||||
void cPluginSatip::Stop(void)
|
||||
{
|
||||
debug("%s", __PRETTY_FUNCTION__);
|
||||
debug1("%s", __PRETTY_FUNCTION__);
|
||||
// Stop any background activities the plugin is performing.
|
||||
cSatipDevice::Shutdown();
|
||||
cSatipDiscover::GetInstance()->Destroy();
|
||||
@ -154,60 +154,60 @@ void cPluginSatip::Stop(void)
|
||||
|
||||
void cPluginSatip::Housekeeping(void)
|
||||
{
|
||||
//debug("%s", __PRETTY_FUNCTION__);
|
||||
debug8("%s", __PRETTY_FUNCTION__);
|
||||
// Perform any cleanup or other regular tasks.
|
||||
}
|
||||
|
||||
void cPluginSatip::MainThreadHook(void)
|
||||
{
|
||||
//debug("%s", __PRETTY_FUNCTION__);
|
||||
debug8("%s", __PRETTY_FUNCTION__);
|
||||
// Perform actions in the context of the main program thread.
|
||||
// WARNING: Use with great care - see PLUGINS.html!
|
||||
}
|
||||
|
||||
cString cPluginSatip::Active(void)
|
||||
{
|
||||
//debug("%s", __PRETTY_FUNCTION__);
|
||||
debug8("%s", __PRETTY_FUNCTION__);
|
||||
// Return a message string if shutdown should be postponed
|
||||
return NULL;
|
||||
}
|
||||
|
||||
time_t cPluginSatip::WakeupTime(void)
|
||||
{
|
||||
//debug("%s", __PRETTY_FUNCTION__);
|
||||
debug8("%s", __PRETTY_FUNCTION__);
|
||||
// Return custom wakeup time for shutdown script
|
||||
return 0;
|
||||
}
|
||||
|
||||
cOsdObject *cPluginSatip::MainMenuAction(void)
|
||||
{
|
||||
//debug("%s", __PRETTY_FUNCTION__);
|
||||
debug8("%s", __PRETTY_FUNCTION__);
|
||||
// Perform the action when selected from the main VDR menu.
|
||||
return NULL;
|
||||
}
|
||||
|
||||
cMenuSetupPage *cPluginSatip::SetupMenu(void)
|
||||
{
|
||||
debug("%s", __PRETTY_FUNCTION__);
|
||||
debug1("%s", __PRETTY_FUNCTION__);
|
||||
// Return a setup menu in case the plugin supports one.
|
||||
return new cSatipPluginSetup();
|
||||
}
|
||||
|
||||
void cPluginSatip::ParseServer(const char *paramP)
|
||||
{
|
||||
debug("%s(%s)", __PRETTY_FUNCTION__, paramP);
|
||||
debug1("%s(%s)", __PRETTY_FUNCTION__, paramP);
|
||||
int n = 0;
|
||||
char *s, *p = (char *)paramP;
|
||||
char *r = strtok_r(p, ";", &s);
|
||||
while (r) {
|
||||
r = skipspace(r);
|
||||
//debug("%s server[%d]=%s", __PRETTY_FUNCTION__, n, r);
|
||||
debug3("%s server[%d]=%s", __PRETTY_FUNCTION__, n, r);
|
||||
cString serverAddr, serverModel, serverDescription;
|
||||
int n2 = 0;
|
||||
char *s2, *p2 = r;
|
||||
char *r2 = strtok_r(p2, "|", &s2);
|
||||
while (r2) {
|
||||
//debug("%s param[%d]=%s", __PRETTY_FUNCTION__, n2, r2);
|
||||
debug3("%s param[%d]=%s", __PRETTY_FUNCTION__, n2, r2);
|
||||
switch (n2++) {
|
||||
case 0:
|
||||
serverAddr = r2;
|
||||
@ -224,7 +224,7 @@ void cPluginSatip::ParseServer(const char *paramP)
|
||||
r2 = strtok_r(NULL, "|", &s2);
|
||||
}
|
||||
if (*serverAddr && *serverModel && *serverDescription) {
|
||||
debug("%s ipaddr=%s model=%s desc=%s", __PRETTY_FUNCTION__, *serverAddr, *serverModel, *serverDescription);
|
||||
debug1("%s ipaddr=%s model=%s desc=%s", __PRETTY_FUNCTION__, *serverAddr, *serverModel, *serverDescription);
|
||||
if (!serversM)
|
||||
serversM = new cSatipDiscoverServers();
|
||||
serversM->Add(new cSatipDiscoverServer(*serverAddr, *serverModel, *serverDescription));
|
||||
@ -236,13 +236,13 @@ void cPluginSatip::ParseServer(const char *paramP)
|
||||
|
||||
int cPluginSatip::ParseSources(const char *valueP, int *sourcesP)
|
||||
{
|
||||
debug("%s(%s,)", __PRETTY_FUNCTION__, valueP);
|
||||
debug1("%s(%s,)", __PRETTY_FUNCTION__, valueP);
|
||||
int n = 0;
|
||||
char *s, *p = (char *)valueP;
|
||||
char *r = strtok_r(p, " ", &s);
|
||||
while (r) {
|
||||
r = skipspace(r);
|
||||
debug("%s sources[%d]=%s", __PRETTY_FUNCTION__, n, r);
|
||||
debug3("%s sources[%d]=%s", __PRETTY_FUNCTION__, n, r);
|
||||
if (n < MAX_DISABLED_SOURCES_COUNT) {
|
||||
sourcesP[n++] = cSource::FromString(r);
|
||||
}
|
||||
@ -253,13 +253,13 @@ int cPluginSatip::ParseSources(const char *valueP, int *sourcesP)
|
||||
|
||||
int cPluginSatip::ParseFilters(const char *valueP, int *filtersP)
|
||||
{
|
||||
debug("%s(%s,)", __PRETTY_FUNCTION__, valueP);
|
||||
debug1("%s(%s,)", __PRETTY_FUNCTION__, valueP);
|
||||
char buffer[256];
|
||||
int n = 0;
|
||||
while (valueP && *valueP && (n < SECTION_FILTER_TABLE_SIZE)) {
|
||||
strn0cpy(buffer, valueP, sizeof(buffer));
|
||||
int i = atoi(buffer);
|
||||
//debug(":%s filters[%d]=%d", __PRETTY_FUNCTION__, n, i);
|
||||
debug3(":%s filters[%d]=%d", __PRETTY_FUNCTION__, n, i);
|
||||
if (i >= 0)
|
||||
filtersP[n++] = i;
|
||||
if ((valueP = strchr(valueP, ' ')) != NULL)
|
||||
@ -270,7 +270,7 @@ int cPluginSatip::ParseFilters(const char *valueP, int *filtersP)
|
||||
|
||||
bool cPluginSatip::SetupParse(const char *nameP, const char *valueP)
|
||||
{
|
||||
debug("%s", __PRETTY_FUNCTION__);
|
||||
debug1("%s", __PRETTY_FUNCTION__);
|
||||
// Parse your own setup parameters and store their values.
|
||||
if (!strcasecmp(nameP, "OperatingMode"))
|
||||
SatipConfig.SetOperatingMode(atoi(valueP));
|
||||
@ -299,13 +299,13 @@ bool cPluginSatip::SetupParse(const char *nameP, const char *valueP)
|
||||
|
||||
bool cPluginSatip::Service(const char *idP, void *dataP)
|
||||
{
|
||||
debug("%s", __PRETTY_FUNCTION__);
|
||||
debug1("%s", __PRETTY_FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
|
||||
const char **cPluginSatip::SVDRPHelpPages(void)
|
||||
{
|
||||
debug("%s", __PRETTY_FUNCTION__);
|
||||
debug1("%s", __PRETTY_FUNCTION__);
|
||||
static const char *HelpPages[] = {
|
||||
"INFO [ <page> ] [ <card index> ]\n"
|
||||
" Prints SAT>IP device information and statistics.\n"
|
||||
@ -330,7 +330,7 @@ const char **cPluginSatip::SVDRPHelpPages(void)
|
||||
|
||||
cString cPluginSatip::SVDRPCommand(const char *commandP, const char *optionP, int &replyCodeP)
|
||||
{
|
||||
debug("%s(%s, %s,)", __PRETTY_FUNCTION__, commandP, optionP);
|
||||
debug1("%s(%s, %s,)", __PRETTY_FUNCTION__, commandP, optionP);
|
||||
if (strcasecmp(commandP, "INFO") == 0) {
|
||||
int index = cDevice::ActualDevice()->CardIndex();
|
||||
int page = SATIP_DEVICE_INFO_ALL;
|
||||
|
@ -21,7 +21,7 @@ cSatipSectionFilter::cSatipSectionFilter(int deviceIndexP, uint16_t pidP, uint8_
|
||||
ringBufferM(new cRingBufferFrame(eDmxMaxSectionCount * eDmxMaxSectionSize)),
|
||||
deviceIndexM(deviceIndexP)
|
||||
{
|
||||
//debug("%s(%d, %d, %d, %d) [device %d]", __PRETTY_FUNCTION__, deviceIndexM, pidM, tidP, maskP, deviceIndexM);
|
||||
debug8("%s(%d, %d, %d, %d) [device %d]", __PRETTY_FUNCTION__, deviceIndexM, pidM, tidP, maskP, deviceIndexM);
|
||||
int i;
|
||||
|
||||
memset(secBufBaseM, 0, sizeof(secBufBaseM));
|
||||
@ -62,7 +62,7 @@ cSatipSectionFilter::cSatipSectionFilter(int deviceIndexP, uint16_t pidP, uint8_
|
||||
|
||||
cSatipSectionFilter::~cSatipSectionFilter()
|
||||
{
|
||||
//debug("%s pid=%d [device %d]", __PRETTY_FUNCTION__, pidM, deviceIndexM);
|
||||
debug8("%s pid=%d [device %d]", __PRETTY_FUNCTION__, pidM, deviceIndexM);
|
||||
int tmp = socketM[1];
|
||||
socketM[1] = -1;
|
||||
if (tmp >= 0)
|
||||
@ -237,7 +237,7 @@ cSatipSectionFilterHandler::cSatipSectionFilterHandler(int deviceIndexP, unsigne
|
||||
mutexM(),
|
||||
deviceIndexM(deviceIndexP)
|
||||
{
|
||||
debug("%s(%d, %d) [device %d]", __PRETTY_FUNCTION__, deviceIndexM, bufferLenP, deviceIndexM);
|
||||
debug1("%s(%d, %d) [device %d]", __PRETTY_FUNCTION__, deviceIndexM, bufferLenP, deviceIndexM);
|
||||
|
||||
// Initialize filter pointers
|
||||
memset(filtersM, 0, sizeof(filtersM));
|
||||
@ -255,7 +255,7 @@ cSatipSectionFilterHandler::cSatipSectionFilterHandler(int deviceIndexP, unsigne
|
||||
|
||||
cSatipSectionFilterHandler::~cSatipSectionFilterHandler()
|
||||
{
|
||||
debug("%s [device %d]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
debug1("%s [device %d]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
// Stop thread
|
||||
if (Running())
|
||||
Cancel(3);
|
||||
@ -269,7 +269,7 @@ cSatipSectionFilterHandler::~cSatipSectionFilterHandler()
|
||||
|
||||
void cSatipSectionFilterHandler::Action(void)
|
||||
{
|
||||
debug("%s Entering [device %d]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
debug1("%s Entering [device %d]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
bool processed = false;
|
||||
// Do the thread loop
|
||||
while (Running()) {
|
||||
@ -300,7 +300,7 @@ void cSatipSectionFilterHandler::Action(void)
|
||||
}
|
||||
}
|
||||
ringBufferM->Del(len);
|
||||
debug("%s Skipped %d bytes to sync on TS packet [device %d]", __PRETTY_FUNCTION__, len, deviceIndexM);
|
||||
debug1("%s Skipped %d bytes to sync on TS packet [device %d]", __PRETTY_FUNCTION__, len, deviceIndexM);
|
||||
continue;
|
||||
}
|
||||
// Process TS packet through all filters
|
||||
@ -316,12 +316,12 @@ void cSatipSectionFilterHandler::Action(void)
|
||||
}
|
||||
cCondWait::SleepMs(10); // to avoid busy loop and reduce cpu load
|
||||
}
|
||||
debug("%s Exiting [device %d]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
debug1("%s Exiting [device %d]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
}
|
||||
|
||||
cString cSatipSectionFilterHandler::GetInformation(void)
|
||||
{
|
||||
//debug("%s [device %d]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
debug8("%s [device %d]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||
// loop through active section filters
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
cString s = "";
|
||||
@ -340,9 +340,9 @@ cString cSatipSectionFilterHandler::GetInformation(void)
|
||||
|
||||
bool cSatipSectionFilterHandler::Delete(unsigned int indexP)
|
||||
{
|
||||
//debug("%s(%d) [device %d]", __PRETTY_FUNCTION__, indexP, deviceIndexM);
|
||||
debug8("%s(%d) [device %d]", __PRETTY_FUNCTION__, indexP, deviceIndexM);
|
||||
if ((indexP < eMaxSecFilterCount) && filtersM[indexP]) {
|
||||
//debug("%s(%d) Found [device %d]", __PRETTY_FUNCTION__, indexP, deviceIndexM);
|
||||
debug3("%s(%d) Found [device %d]", __PRETTY_FUNCTION__, indexP, deviceIndexM);
|
||||
cSatipSectionFilter *tmp = filtersM[indexP];
|
||||
filtersM[indexP] = NULL;
|
||||
delete tmp;
|
||||
@ -353,7 +353,7 @@ bool cSatipSectionFilterHandler::Delete(unsigned int indexP)
|
||||
|
||||
bool cSatipSectionFilterHandler::IsBlackListed(u_short pidP, u_char tidP, u_char maskP) const
|
||||
{
|
||||
//debug("%s(%d, %02X, %02X) [device %d]", __PRETTY_FUNCTION__, pidP, tidP, maskP, deviceIndexM);
|
||||
debug8("%s(%d, %02X, %02X) [device %d]", __PRETTY_FUNCTION__, pidP, tidP, maskP, deviceIndexM);
|
||||
// loop through section filter table
|
||||
for (int i = 0; i < SECTION_FILTER_TABLE_SIZE; ++i) {
|
||||
int index = SatipConfig.GetDisabledFilters(i);
|
||||
@ -361,7 +361,7 @@ bool cSatipSectionFilterHandler::IsBlackListed(u_short pidP, u_char tidP, u_char
|
||||
if ((index >= 0) && (index < SECTION_FILTER_TABLE_SIZE) &&
|
||||
(section_filter_table[index].pid == pidP) && (section_filter_table[index].tid == tidP) &&
|
||||
(section_filter_table[index].mask == maskP)) {
|
||||
//debug("%s Found %s [device %d]", __PRETTY_FUNCTION__, section_filter_table[index].description, deviceIndexM);
|
||||
debug3("%s Found %s [device %d]", __PRETTY_FUNCTION__, section_filter_table[index].description, deviceIndexM);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -379,7 +379,7 @@ int cSatipSectionFilterHandler::Open(u_short pidP, u_char tidP, u_char maskP)
|
||||
for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) {
|
||||
if (!filtersM[i]) {
|
||||
filtersM[i] = new cSatipSectionFilter(deviceIndexM, pidP, tidP, maskP);
|
||||
//debug("%s(%d, %02X, %02X) handle=%d index=%u [device %d]", __PRETTY_FUNCTION__, pidP, tidP, maskP, filtersM[i]->GetFd(), i, deviceIndexM);
|
||||
debug8("%s(%d, %02X, %02X) handle=%d index=%u [device %d]", __PRETTY_FUNCTION__, pidP, tidP, maskP, filtersM[i]->GetFd(), i, deviceIndexM);
|
||||
return filtersM[i]->GetFd();
|
||||
}
|
||||
}
|
||||
@ -394,7 +394,7 @@ void cSatipSectionFilterHandler::Close(int handleP)
|
||||
// Search the filter for deletion
|
||||
for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) {
|
||||
if (filtersM[i] && (handleP == filtersM[i]->GetFd())) {
|
||||
//debug("%s(%d) pid=%d index=%u [device %d]", __PRETTY_FUNCTION__, handleP, filtersM[i]->GetPid(), i, deviceIndexM);
|
||||
debug3("%s(%d) pid=%d index=%u [device %d]", __PRETTY_FUNCTION__, handleP, filtersM[i]->GetPid(), i, deviceIndexM);
|
||||
Delete(i);
|
||||
break;
|
||||
}
|
||||
@ -408,7 +408,7 @@ int cSatipSectionFilterHandler::GetPid(int handleP)
|
||||
// Search the filter for data
|
||||
for (unsigned int i = 0; i < eMaxSecFilterCount; ++i) {
|
||||
if (filtersM[i] && (handleP == filtersM[i]->GetFd())) {
|
||||
//debug("%s(%d) pid=%d index=%u [device %d]", __PRETTY_FUNCTION__, handleP, filtersM[i]->GetPid(), i, deviceIndexM);
|
||||
debug3("%s(%d) pid=%d index=%u [device %d]", __PRETTY_FUNCTION__, handleP, filtersM[i]->GetPid(), i, deviceIndexM);
|
||||
return filtersM[i]->GetPid();
|
||||
}
|
||||
}
|
||||
@ -417,7 +417,7 @@ int cSatipSectionFilterHandler::GetPid(int handleP)
|
||||
|
||||
void cSatipSectionFilterHandler::Write(uchar *bufferP, int lengthP)
|
||||
{
|
||||
//debug("%s(, %d) [device %d]", __PRETTY_FUNCTION__, lengthP, deviceIndexM);
|
||||
debug8("%s(, %d) [device %d]", __PRETTY_FUNCTION__, lengthP, deviceIndexM);
|
||||
// Fill up the buffer
|
||||
if (ringBufferM) {
|
||||
int len = ringBufferM->Put(bufferP, lengthP);
|
||||
|
14
setup.c
14
setup.c
@ -333,7 +333,7 @@ cSatipPluginSetup::cSatipPluginSetup()
|
||||
numDisabledSourcesM(SatipConfig.GetDisabledSourcesCount()),
|
||||
numDisabledFiltersM(SatipConfig.GetDisabledFiltersCount())
|
||||
{
|
||||
debug("%s", __PRETTY_FUNCTION__);
|
||||
debug1("%s", __PRETTY_FUNCTION__);
|
||||
operatingModeTextsM[cSatipConfig::eOperatingModeOff] = tr("off");
|
||||
operatingModeTextsM[cSatipConfig::eOperatingModeLow] = tr("low");
|
||||
operatingModeTextsM[cSatipConfig::eOperatingModeNormal] = tr("normal");
|
||||
@ -399,7 +399,7 @@ void cSatipPluginSetup::Setup(void)
|
||||
|
||||
eOSState cSatipPluginSetup::DeviceScan(void)
|
||||
{
|
||||
debug("%s", __PRETTY_FUNCTION__);
|
||||
debug1("%s", __PRETTY_FUNCTION__);
|
||||
cSatipDiscover::GetInstance()->TriggerScan();
|
||||
|
||||
return osContinue;
|
||||
@ -407,7 +407,7 @@ eOSState cSatipPluginSetup::DeviceScan(void)
|
||||
|
||||
eOSState cSatipPluginSetup::DeviceInfo(void)
|
||||
{
|
||||
debug("%s", __PRETTY_FUNCTION__);
|
||||
debug1("%s", __PRETTY_FUNCTION__);
|
||||
if (HasSubMenu() || Count() == 0)
|
||||
return osContinue;
|
||||
|
||||
@ -420,7 +420,7 @@ eOSState cSatipPluginSetup::DeviceInfo(void)
|
||||
|
||||
eOSState cSatipPluginSetup::ShowDeviceStatus(void)
|
||||
{
|
||||
debug("%s", __PRETTY_FUNCTION__);
|
||||
debug1("%s", __PRETTY_FUNCTION__);
|
||||
if (HasSubMenu() || Count() == 0)
|
||||
return osContinue;
|
||||
|
||||
@ -429,7 +429,7 @@ eOSState cSatipPluginSetup::ShowDeviceStatus(void)
|
||||
|
||||
eOSState cSatipPluginSetup::ShowInfo(void)
|
||||
{
|
||||
debug("%s", __PRETTY_FUNCTION__);
|
||||
debug1("%s", __PRETTY_FUNCTION__);
|
||||
if (HasSubMenu() || Count() == 0)
|
||||
return osContinue;
|
||||
|
||||
@ -486,7 +486,7 @@ void cSatipPluginSetup::StoreSources(const char *nameP, int *sourcesP)
|
||||
else
|
||||
buffer = cString::sprintf("%s", *cSource::ToString(sourcesP[i]));
|
||||
}
|
||||
debug("%s(%s, %s)", __PRETTY_FUNCTION__, nameP, *buffer);
|
||||
debug1("%s(%s, %s)", __PRETTY_FUNCTION__, nameP, *buffer);
|
||||
SetupStore(nameP, *buffer);
|
||||
}
|
||||
|
||||
@ -502,7 +502,7 @@ void cSatipPluginSetup::StoreFilters(const char *nameP, int *valuesP)
|
||||
else
|
||||
buffer = cString::sprintf("%d", valuesP[i]);
|
||||
}
|
||||
debug("%s(%s, %s)", __PRETTY_FUNCTION__, nameP, *buffer);
|
||||
debug1("%s(%s, %s)", __PRETTY_FUNCTION__, nameP, *buffer);
|
||||
SetupStore(nameP, *buffer);
|
||||
}
|
||||
|
||||
|
14
socket.c
14
socket.c
@ -23,13 +23,13 @@ cSatipSocket::cSatipSocket()
|
||||
: socketPortM(0),
|
||||
socketDescM(-1)
|
||||
{
|
||||
debug("%s", __PRETTY_FUNCTION__);
|
||||
debug1("%s", __PRETTY_FUNCTION__);
|
||||
memset(&sockAddrM, 0, sizeof(sockAddrM));
|
||||
}
|
||||
|
||||
cSatipSocket::~cSatipSocket()
|
||||
{
|
||||
debug("%s", __PRETTY_FUNCTION__);
|
||||
debug1("%s", __PRETTY_FUNCTION__);
|
||||
// Close the socket
|
||||
Close();
|
||||
}
|
||||
@ -61,13 +61,13 @@ bool cSatipSocket::Open(const int portP)
|
||||
"getsockname()", Close(), return false);
|
||||
socketPortM = ntohs(sockAddrM.sin_port);
|
||||
}
|
||||
debug("%s(%d) socketPort=%d", __PRETTY_FUNCTION__, portP, socketPortM);
|
||||
debug1("%s(%d) socketPort=%d", __PRETTY_FUNCTION__, portP, socketPortM);
|
||||
return true;
|
||||
}
|
||||
|
||||
void cSatipSocket::Close(void)
|
||||
{
|
||||
debug("%s sockerPort=%d", __PRETTY_FUNCTION__, socketPortM);
|
||||
debug1("%s sockerPort=%d", __PRETTY_FUNCTION__, socketPortM);
|
||||
// Check if socket exists
|
||||
if (socketDescM >= 0) {
|
||||
close(socketDescM);
|
||||
@ -79,7 +79,7 @@ void cSatipSocket::Close(void)
|
||||
|
||||
bool cSatipSocket::Flush(void)
|
||||
{
|
||||
debug("%s", __PRETTY_FUNCTION__);
|
||||
debug1("%s", __PRETTY_FUNCTION__);
|
||||
if (socketDescM < 0) {
|
||||
const unsigned int len = 65535;
|
||||
unsigned char *buf = MALLOC(unsigned char, len);
|
||||
@ -98,7 +98,7 @@ bool cSatipSocket::Flush(void)
|
||||
|
||||
int cSatipSocket::Read(unsigned char *bufferAddrP, unsigned int bufferLenP)
|
||||
{
|
||||
//debug("%s(, %d)", __PRETTY_FUNCTION__, bufferLenP);
|
||||
debug8("%s(, %d)", __PRETTY_FUNCTION__, bufferLenP);
|
||||
// Error out if socket not initialized
|
||||
if (socketDescM <= 0) {
|
||||
error("Invalid socket in %s()", __PRETTY_FUNCTION__);
|
||||
@ -136,7 +136,7 @@ int cSatipSocket::Read(unsigned char *bufferAddrP, unsigned int bufferLenP)
|
||||
|
||||
bool cSatipSocket::Write(const char *addrP, const unsigned char *bufferAddrP, unsigned int bufferLenP)
|
||||
{
|
||||
debug("%s(%s, , %d)", __PRETTY_FUNCTION__, addrP, bufferLenP);
|
||||
debug1("%s(%s, , %d)", __PRETTY_FUNCTION__, addrP, bufferLenP);
|
||||
// Error out if socket not initialized
|
||||
if (socketDescM <= 0) {
|
||||
error("%s Invalid socket", __PRETTY_FUNCTION__);
|
||||
|
34
statistics.c
34
statistics.c
@ -19,17 +19,17 @@ cSatipSectionStatistics::cSatipSectionStatistics()
|
||||
timerM(),
|
||||
mutexM()
|
||||
{
|
||||
//debug("%s", __PRETTY_FUNCTION__);
|
||||
debug8("%s", __PRETTY_FUNCTION__);
|
||||
}
|
||||
|
||||
cSatipSectionStatistics::~cSatipSectionStatistics()
|
||||
{
|
||||
//debug("%s", __PRETTY_FUNCTION__);
|
||||
debug8("%s", __PRETTY_FUNCTION__);
|
||||
}
|
||||
|
||||
cString cSatipSectionStatistics::GetSectionStatistic()
|
||||
{
|
||||
//debug("%s", __PRETTY_FUNCTION__);
|
||||
debug8("%s", __PRETTY_FUNCTION__);
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
uint64_t elapsed = timerM.Elapsed(); /* in milliseconds */
|
||||
timerM.Set();
|
||||
@ -45,7 +45,7 @@ cString cSatipSectionStatistics::GetSectionStatistic()
|
||||
|
||||
void cSatipSectionStatistics::AddSectionStatistic(long bytesP, long callsP)
|
||||
{
|
||||
//debug("%s(%ld, %ld)", __PRETTY_FUNCTION__, bytesP, callsP);
|
||||
debug8("%s(%ld, %ld)", __PRETTY_FUNCTION__, bytesP, callsP);
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
filteredDataM += bytesP;
|
||||
numberOfCallsM += callsP;
|
||||
@ -58,7 +58,7 @@ cSatipPidStatistics::cSatipPidStatistics()
|
||||
: timerM(),
|
||||
mutexM()
|
||||
{
|
||||
debug("%s", __PRETTY_FUNCTION__);
|
||||
debug1("%s", __PRETTY_FUNCTION__);
|
||||
const int numberOfElements = sizeof(mostActivePidsM) / sizeof(pidStruct);
|
||||
for (int i = 0; i < numberOfElements; ++i) {
|
||||
mostActivePidsM[i].pid = -1;
|
||||
@ -68,12 +68,12 @@ cSatipPidStatistics::cSatipPidStatistics()
|
||||
|
||||
cSatipPidStatistics::~cSatipPidStatistics()
|
||||
{
|
||||
debug("%s", __PRETTY_FUNCTION__);
|
||||
debug1("%s", __PRETTY_FUNCTION__);
|
||||
}
|
||||
|
||||
cString cSatipPidStatistics::GetPidStatistic()
|
||||
{
|
||||
//debug("%s", __PRETTY_FUNCTION__);
|
||||
debug8("%s", __PRETTY_FUNCTION__);
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
const int numberOfElements = sizeof(mostActivePidsM) / sizeof(pidStruct);
|
||||
uint64_t elapsed = timerM.Elapsed(); /* in milliseconds */
|
||||
@ -98,7 +98,7 @@ cString cSatipPidStatistics::GetPidStatistic()
|
||||
|
||||
int cSatipPidStatistics::SortPids(const void* data1P, const void* data2P)
|
||||
{
|
||||
//debug("%s", __PRETTY_FUNCTION__);
|
||||
debug8("%s", __PRETTY_FUNCTION__);
|
||||
const pidStruct *comp1 = reinterpret_cast<const pidStruct*>(data1P);
|
||||
const pidStruct *comp2 = reinterpret_cast<const pidStruct*>(data2P);
|
||||
if (comp1->dataAmount > comp2->dataAmount)
|
||||
@ -110,7 +110,7 @@ int cSatipPidStatistics::SortPids(const void* data1P, const void* data2P)
|
||||
|
||||
void cSatipPidStatistics::AddPidStatistic(int pidP, long payloadP)
|
||||
{
|
||||
//debug("%s(%ld, %ld)", __PRETTY_FUNCTION__, pidP, payloadP);
|
||||
debug8("%s(%d, %ld)", __PRETTY_FUNCTION__, pidP, payloadP);
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
const int numberOfElements = sizeof(mostActivePidsM) / sizeof(pidStruct);
|
||||
// If our statistic already is in the array, update it and quit
|
||||
@ -140,17 +140,17 @@ cSatipTunerStatistics::cSatipTunerStatistics()
|
||||
timerM(),
|
||||
mutexM()
|
||||
{
|
||||
debug("%s", __PRETTY_FUNCTION__);
|
||||
debug1("%s", __PRETTY_FUNCTION__);
|
||||
}
|
||||
|
||||
cSatipTunerStatistics::~cSatipTunerStatistics()
|
||||
{
|
||||
debug("%s", __PRETTY_FUNCTION__);
|
||||
debug1("%s", __PRETTY_FUNCTION__);
|
||||
}
|
||||
|
||||
cString cSatipTunerStatistics::GetTunerStatistic()
|
||||
{
|
||||
//debug("%s", __PRETTY_FUNCTION__);
|
||||
debug8("%s", __PRETTY_FUNCTION__);
|
||||
mutexM.Lock();
|
||||
uint64_t elapsed = timerM.Elapsed(); /* in milliseconds */
|
||||
timerM.Set();
|
||||
@ -166,7 +166,7 @@ cString cSatipTunerStatistics::GetTunerStatistic()
|
||||
|
||||
void cSatipTunerStatistics::AddTunerStatistic(long bytesP)
|
||||
{
|
||||
//debug("%s(%ld)", __PRETTY_FUNCTION__, bytesP);
|
||||
debug8("%s(%ld)", __PRETTY_FUNCTION__, bytesP);
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
dataBytesM += bytesP;
|
||||
}
|
||||
@ -180,17 +180,17 @@ cSatipBufferStatistics::cSatipBufferStatistics()
|
||||
timerM(),
|
||||
mutexM()
|
||||
{
|
||||
debug("%s", __PRETTY_FUNCTION__);
|
||||
debug1("%s", __PRETTY_FUNCTION__);
|
||||
}
|
||||
|
||||
cSatipBufferStatistics::~cSatipBufferStatistics()
|
||||
{
|
||||
debug("%s", __PRETTY_FUNCTION__);
|
||||
debug1("%s", __PRETTY_FUNCTION__);
|
||||
}
|
||||
|
||||
cString cSatipBufferStatistics::GetBufferStatistic()
|
||||
{
|
||||
//debug("%s", __PRETTY_FUNCTION__);
|
||||
debug8("%s", __PRETTY_FUNCTION__);
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
uint64_t elapsed = timerM.Elapsed(); /* in milliseconds */
|
||||
timerM.Set();
|
||||
@ -214,7 +214,7 @@ cString cSatipBufferStatistics::GetBufferStatistic()
|
||||
|
||||
void cSatipBufferStatistics::AddBufferStatistic(long bytesP, long usedP)
|
||||
{
|
||||
//debug("%s(%ld, %ld)", __PRETTY_FUNCTION__, bytesP, usedP);
|
||||
debug8("%s(%ld, %ld)", __PRETTY_FUNCTION__, bytesP, usedP);
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
dataBytesM += bytesP;
|
||||
if (usedP > usedSpaceM)
|
||||
|
68
tuner.c
68
tuner.c
@ -42,7 +42,7 @@ cSatipTuner::cSatipTuner(cSatipDeviceIf &deviceP, unsigned int packetLenP)
|
||||
delPidsM(),
|
||||
pidsM()
|
||||
{
|
||||
debug("%s(, %d) [device %d]", __PRETTY_FUNCTION__, packetLenP, deviceIdM);
|
||||
debug1("%s(, %d) [device %d]", __PRETTY_FUNCTION__, packetLenP, deviceIdM);
|
||||
|
||||
// Open sockets
|
||||
int i = 100;
|
||||
@ -65,7 +65,7 @@ cSatipTuner::cSatipTuner(cSatipDeviceIf &deviceP, unsigned int packetLenP)
|
||||
|
||||
cSatipTuner::~cSatipTuner()
|
||||
{
|
||||
debug("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
debug1("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
|
||||
// Stop thread
|
||||
sleepM.Signal();
|
||||
@ -85,22 +85,22 @@ cSatipTuner::~cSatipTuner()
|
||||
|
||||
void cSatipTuner::Action(void)
|
||||
{
|
||||
debug("%s Entering [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
debug1("%s Entering [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
reConnectM.Set(eConnectTimeoutMs);
|
||||
// Do the thread loop
|
||||
while (Running()) {
|
||||
UpdateCurrentState();
|
||||
switch (currentStateM) {
|
||||
case tsIdle:
|
||||
//debug("%s: tsIdle [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
debug4("%s: tsIdle [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
break;
|
||||
case tsRelease:
|
||||
//debug("%s: tsRelease [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
debug4("%s: tsRelease [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
Disconnect();
|
||||
RequestState(tsIdle, smInternal);
|
||||
break;
|
||||
case tsSet:
|
||||
//debug("%s: tsSet [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
debug4("%s: tsSet [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
reConnectM.Set(eConnectTimeoutMs);
|
||||
if (Connect()) {
|
||||
RequestState(tsTuned, smInternal);
|
||||
@ -112,7 +112,7 @@ void cSatipTuner::Action(void)
|
||||
}
|
||||
break;
|
||||
case tsTuned:
|
||||
//debug("%s: tsTuned [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
debug4("%s: tsTuned [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
reConnectM.Set(eConnectTimeoutMs);
|
||||
// Read reception statistics via DESCRIBE and RTCP
|
||||
if (hasLockM || ReadReceptionStatus()) {
|
||||
@ -127,7 +127,7 @@ void cSatipTuner::Action(void)
|
||||
}
|
||||
break;
|
||||
case tsLocked:
|
||||
//debug("%s: tsLocked [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
debug4("%s: tsLocked [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
if (!UpdatePids()) {
|
||||
error("Pid update failed - retuning [device %d]", deviceIdM);
|
||||
RequestState(tsSet, smInternal);
|
||||
@ -151,13 +151,13 @@ void cSatipTuner::Action(void)
|
||||
if (!StateRequested())
|
||||
sleepM.Wait(eSleepTimeoutMs); // to avoid busy loop and reduce cpu load
|
||||
}
|
||||
debug("%s Exiting [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
debug1("%s Exiting [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
}
|
||||
|
||||
bool cSatipTuner::Open(void)
|
||||
{
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
debug("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
debug1("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
|
||||
RequestState(tsSet, smExternal);
|
||||
|
||||
@ -168,7 +168,7 @@ bool cSatipTuner::Open(void)
|
||||
bool cSatipTuner::Close(void)
|
||||
{
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
debug("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
debug1("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
|
||||
RequestState(tsRelease, smExternal);
|
||||
|
||||
@ -179,14 +179,14 @@ bool cSatipTuner::Close(void)
|
||||
bool cSatipTuner::Connect(void)
|
||||
{
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
debug("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
debug1("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
|
||||
if (!isempty(*streamAddrM)) {
|
||||
cString connectionUri = cString::sprintf("rtsp://%s/", *streamAddrM);
|
||||
// Just retune
|
||||
if (streamIdM >= 0) {
|
||||
cString uri = cString::sprintf("%sstream=%d?%s", *connectionUri, streamIdM, *streamParamM);
|
||||
debug("%s Retuning [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
debug1("%s Retuning [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
if (rtspM.Play(*uri)) {
|
||||
keepAliveM.Set(timeoutM);
|
||||
return true;
|
||||
@ -219,7 +219,7 @@ bool cSatipTuner::Connect(void)
|
||||
bool cSatipTuner::Disconnect(void)
|
||||
{
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
debug("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
debug1("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
|
||||
if (!isempty(*streamAddrM) && (streamIdM >= 0)) {
|
||||
cString uri = cString::sprintf("rtsp://%s/stream=%d", *streamAddrM, streamIdM);
|
||||
@ -245,7 +245,7 @@ bool cSatipTuner::Disconnect(void)
|
||||
|
||||
void cSatipTuner::ProcessVideoData(u_char *bufferP, int lengthP)
|
||||
{
|
||||
//debug("%s(, %d) [device %d]", __PRETTY_FUNCTION__, lengthP, deviceIdM);
|
||||
debug8("%s(, %d) [device %d]", __PRETTY_FUNCTION__, lengthP, deviceIdM);
|
||||
if (lengthP > 0) {
|
||||
AddTunerStatistic(lengthP);
|
||||
deviceM->WriteData(bufferP, lengthP);
|
||||
@ -255,7 +255,7 @@ void cSatipTuner::ProcessVideoData(u_char *bufferP, int lengthP)
|
||||
|
||||
void cSatipTuner::ProcessApplicationData(u_char *bufferP, int lengthP)
|
||||
{
|
||||
//debug("%s(%d) [device %d]", __PRETTY_FUNCTION__, lengthP, deviceIdM);
|
||||
debug8("%s(%d) [device %d]", __PRETTY_FUNCTION__, lengthP, deviceIdM);
|
||||
// DVB-S2:
|
||||
// ver=<major>.<minor>;src=<srcID>;tuner=<feID>,<level>,<lock>,<quality>,<frequency>,<polarisation>,<system>,<type>,<pilots>,<roll_off>,<symbol_rate>,<fec_inner>;pids=<pid0>,...,<pidn>
|
||||
// DVB-T2:
|
||||
@ -265,7 +265,7 @@ void cSatipTuner::ProcessApplicationData(u_char *bufferP, int lengthP)
|
||||
if (lengthP > 0) {
|
||||
char s[lengthP];
|
||||
memcpy(s, (char *)bufferP, lengthP);
|
||||
//debug("%s(%s) [device %d]", __PRETTY_FUNCTION__, s, deviceIdM);
|
||||
debug8("%s(%s) [device %d]", __PRETTY_FUNCTION__, s, deviceIdM);
|
||||
char *c = strstr(s, ";tuner=");
|
||||
if (c) {
|
||||
int value;
|
||||
@ -306,27 +306,27 @@ void cSatipTuner::ProcessApplicationData(u_char *bufferP, int lengthP)
|
||||
void cSatipTuner::SetStreamId(int streamIdP)
|
||||
{
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
debug("%s(%d) [device %d]", __PRETTY_FUNCTION__, streamIdP, deviceIdM);
|
||||
debug1("%s(%d) [device %d]", __PRETTY_FUNCTION__, streamIdP, deviceIdM);
|
||||
streamIdM = streamIdP;
|
||||
}
|
||||
|
||||
void cSatipTuner::SetSessionTimeout(const char *sessionP, int timeoutP)
|
||||
{
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
debug("%s(%s, %d) [device %d]", __PRETTY_FUNCTION__, sessionP, timeoutP, deviceIdM);
|
||||
debug1("%s(%s, %d) [device %d]", __PRETTY_FUNCTION__, sessionP, timeoutP, deviceIdM);
|
||||
sessionM = sessionP;
|
||||
timeoutM = (timeoutP > eMinKeepAliveIntervalMs) ? timeoutP : eMinKeepAliveIntervalMs;
|
||||
}
|
||||
|
||||
int cSatipTuner::GetId(void)
|
||||
{
|
||||
//debug("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
debug8("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
return deviceIdM;
|
||||
}
|
||||
|
||||
bool cSatipTuner::SetSource(cSatipServer *serverP, const char *parameterP, const int indexP)
|
||||
{
|
||||
debug("%s(%s, %d) [device %d]", __PRETTY_FUNCTION__, parameterP, indexP, deviceIdM);
|
||||
debug1("%s(%s, %d) [device %d]", __PRETTY_FUNCTION__, parameterP, indexP, deviceIdM);
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
if (serverP) {
|
||||
nextServerM = cSatipDiscover::GetInstance()->GetServer(serverP);
|
||||
@ -348,7 +348,7 @@ bool cSatipTuner::SetSource(cSatipServer *serverP, const char *parameterP, const
|
||||
|
||||
bool cSatipTuner::SetPid(int pidP, int typeP, bool onP)
|
||||
{
|
||||
//debug("%s(%d, %d, %d) [device %d]", __PRETTY_FUNCTION__, pidP, typeP, onP, deviceIdM);
|
||||
debug8("%s(%d, %d, %d) [device %d]", __PRETTY_FUNCTION__, pidP, typeP, onP, deviceIdM);
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
if (onP) {
|
||||
pidsM.AddPid(pidP);
|
||||
@ -368,7 +368,7 @@ bool cSatipTuner::SetPid(int pidP, int typeP, bool onP)
|
||||
|
||||
bool cSatipTuner::UpdatePids(bool forceP)
|
||||
{
|
||||
//debug("%s(%d) tunerState=%s [device %d]", __PRETTY_FUNCTION__, forceP, TunerStateString(currentStateM), deviceIdM);
|
||||
debug8("%s(%d) tunerState=%s [device %d]", __PRETTY_FUNCTION__, forceP, TunerStateString(currentStateM), deviceIdM);
|
||||
if (((forceP && pidsM.Size()) || (pidUpdateCacheM.TimedOut() && (addPidsM.Size() || delPidsM.Size()))) &&
|
||||
!isempty(*streamAddrM) && (streamIdM > 0)) {
|
||||
cString uri = cString::sprintf("rtsp://%s/stream=%d", *streamAddrM, streamIdM);
|
||||
@ -405,7 +405,7 @@ bool cSatipTuner::UpdatePids(bool forceP)
|
||||
|
||||
bool cSatipTuner::KeepAlive(bool forceP)
|
||||
{
|
||||
//debug("%s(%d) tunerState=%s [device %d]", __PRETTY_FUNCTION__, forceP, TunerStateString(currentStateM), deviceIdM);
|
||||
debug8("%s(%d) tunerState=%s [device %d]", __PRETTY_FUNCTION__, forceP, TunerStateString(currentStateM), deviceIdM);
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
if (keepAliveM.TimedOut()) {
|
||||
keepAliveM.Set(timeoutM);
|
||||
@ -422,7 +422,7 @@ bool cSatipTuner::KeepAlive(bool forceP)
|
||||
|
||||
bool cSatipTuner::ReadReceptionStatus(bool forceP)
|
||||
{
|
||||
//debug("%s(%d) tunerState=%s [device %d]", __PRETTY_FUNCTION__, forceP, TunerStateString(currentStateM), deviceIdM);
|
||||
debug8("%s(%d) tunerState=%s [device %d]", __PRETTY_FUNCTION__, forceP, TunerStateString(currentStateM), deviceIdM);
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
if (statusUpdateM.TimedOut()) {
|
||||
statusUpdateM.Set(eStatusUpdateTimeoutMs);
|
||||
@ -439,7 +439,7 @@ bool cSatipTuner::ReadReceptionStatus(bool forceP)
|
||||
|
||||
void cSatipTuner::UpdateCurrentState(void)
|
||||
{
|
||||
//debug("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
debug8("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
eTunerState state = currentStateM;
|
||||
|
||||
@ -453,7 +453,7 @@ void cSatipTuner::UpdateCurrentState(void)
|
||||
}
|
||||
|
||||
if (currentStateM != state) {
|
||||
debug("%s: switching from %s to %s [device %d]", __PRETTY_FUNCTION__, TunerStateString(currentStateM), TunerStateString(state), deviceIdM);
|
||||
debug1("%s: switching from %s to %s [device %d]", __PRETTY_FUNCTION__, TunerStateString(currentStateM), TunerStateString(state), deviceIdM);
|
||||
currentStateM = state;
|
||||
}
|
||||
}
|
||||
@ -461,7 +461,7 @@ void cSatipTuner::UpdateCurrentState(void)
|
||||
bool cSatipTuner::StateRequested(void)
|
||||
{
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
//debug("%s current=%s internal=%d external=%d [device %d]", __PRETTY_FUNCTION__, TunerStateString(currentStateM), internalStateM.Size(), externalStateM.Size(), deviceIdM);
|
||||
debug8("%s current=%s internal=%d external=%d [device %d]", __PRETTY_FUNCTION__, TunerStateString(currentStateM), internalStateM.Size(), externalStateM.Size(), deviceIdM);
|
||||
|
||||
return (internalStateM.Size() || externalStateM.Size());
|
||||
}
|
||||
@ -469,7 +469,7 @@ bool cSatipTuner::StateRequested(void)
|
||||
bool cSatipTuner::RequestState(eTunerState stateP, eStateMode modeP)
|
||||
{
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
debug("%s(%s, %s) current=%s internal=%d external=%d [device %d]", __PRETTY_FUNCTION__, TunerStateString(stateP), StateModeString(modeP), TunerStateString(currentStateM), internalStateM.Size(), externalStateM.Size(), deviceIdM);
|
||||
debug1("%s(%s, %s) current=%s internal=%d external=%d [device %d]", __PRETTY_FUNCTION__, TunerStateString(stateP), StateModeString(modeP), TunerStateString(currentStateM), internalStateM.Size(), externalStateM.Size(), deviceIdM);
|
||||
|
||||
if (modeP == smExternal)
|
||||
externalStateM.Append(stateP);
|
||||
@ -533,30 +533,30 @@ const char *cSatipTuner::TunerStateString(eTunerState stateP)
|
||||
|
||||
int cSatipTuner::SignalStrength(void)
|
||||
{
|
||||
//debug("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
debug8("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
return signalStrengthM;
|
||||
}
|
||||
|
||||
int cSatipTuner::SignalQuality(void)
|
||||
{
|
||||
//debug("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
debug8("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
return signalQualityM;
|
||||
}
|
||||
|
||||
bool cSatipTuner::HasLock(void)
|
||||
{
|
||||
//debug("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
debug8("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
return (currentStateM >= tsTuned) && hasLockM;
|
||||
}
|
||||
|
||||
cString cSatipTuner::GetSignalStatus(void)
|
||||
{
|
||||
//debug("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
debug8("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
return cString::sprintf("lock=%d strength=%d quality=%d", HasLock(), SignalStrength(), SignalQuality());
|
||||
}
|
||||
|
||||
cString cSatipTuner::GetInformation(void)
|
||||
{
|
||||
//debug("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
debug8("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||
return (currentStateM >= tsTuned) ? cString::sprintf("rtsp://%s/?%s [stream=%d]", *streamAddrM, *streamParamM, streamIdM) : "connection failed";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user