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