mirror of
https://github.com/rofafor/vdr-plugin-satip.git
synced 2023-10-10 13:37:42 +02:00
Reformat debug messages.
This commit is contained in:
parent
9a40a8eeec
commit
81f6af3bdf
2
config.c
2
config.c
@ -67,6 +67,6 @@ void cSatipConfig::SetDisabledFilters(unsigned int indexP, int numberP)
|
|||||||
|
|
||||||
void cSatipConfig::SetConfigDirectory(const char *directoryP)
|
void cSatipConfig::SetConfigDirectory(const char *directoryP)
|
||||||
{
|
{
|
||||||
debug("cSatipConfig::%s(%s)", __FUNCTION__, directoryP);
|
debug("%s(%s)", __PRETTY_FUNCTION__, directoryP);
|
||||||
ERROR_IF(!realpath(directoryP, configDirectoryM), "Cannot canonicalize configuration directory");
|
ERROR_IF(!realpath(directoryP, configDirectoryM), "Cannot canonicalize configuration directory");
|
||||||
}
|
}
|
||||||
|
64
device.c
64
device.c
@ -25,7 +25,7 @@ cSatipDevice::cSatipDevice(unsigned int indexP)
|
|||||||
{
|
{
|
||||||
unsigned int bufsize = (unsigned int)SATIP_BUFFER_SIZE;
|
unsigned int bufsize = (unsigned int)SATIP_BUFFER_SIZE;
|
||||||
bufsize -= (bufsize % TS_SIZE);
|
bufsize -= (bufsize % TS_SIZE);
|
||||||
isyslog("creating SAT>IP device %d (CardIndex=%d)", deviceIndexM, CardIndex());
|
info("Creating SAT>IP CardIndex=%d [device %u]", CardIndex(), deviceIndexM);
|
||||||
tsBufferM = new cRingBufferLinear(bufsize + 1, TS_SIZE, false,
|
tsBufferM = new cRingBufferLinear(bufsize + 1, TS_SIZE, false,
|
||||||
*cString::sprintf("SAT>IP TS %d", deviceIndexM));
|
*cString::sprintf("SAT>IP TS %d", deviceIndexM));
|
||||||
if (tsBufferM) {
|
if (tsBufferM) {
|
||||||
@ -40,7 +40,7 @@ cSatipDevice::cSatipDevice(unsigned int indexP)
|
|||||||
|
|
||||||
cSatipDevice::~cSatipDevice()
|
cSatipDevice::~cSatipDevice()
|
||||||
{
|
{
|
||||||
debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM);
|
debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||||
// Stop section handler
|
// Stop section handler
|
||||||
StopSectionHandler();
|
StopSectionHandler();
|
||||||
DELETE_POINTER(pSectionFilterHandlerM);
|
DELETE_POINTER(pSectionFilterHandlerM);
|
||||||
@ -50,7 +50,7 @@ cSatipDevice::~cSatipDevice()
|
|||||||
|
|
||||||
bool cSatipDevice::Initialize(unsigned int deviceCountP)
|
bool cSatipDevice::Initialize(unsigned int deviceCountP)
|
||||||
{
|
{
|
||||||
debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceCountP);
|
debug("%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)
|
||||||
@ -62,7 +62,7 @@ bool cSatipDevice::Initialize(unsigned int deviceCountP)
|
|||||||
|
|
||||||
void cSatipDevice::Shutdown(void)
|
void cSatipDevice::Shutdown(void)
|
||||||
{
|
{
|
||||||
debug("cSatipDevice::%s()", __FUNCTION__);
|
debug("%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();
|
||||||
@ -72,7 +72,7 @@ void cSatipDevice::Shutdown(void)
|
|||||||
unsigned int cSatipDevice::Count(void)
|
unsigned int cSatipDevice::Count(void)
|
||||||
{
|
{
|
||||||
unsigned int count = 0;
|
unsigned int count = 0;
|
||||||
debug("cSatipDevice::%s()", __FUNCTION__);
|
debug("%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++;
|
||||||
@ -82,10 +82,10 @@ unsigned int cSatipDevice::Count(void)
|
|||||||
|
|
||||||
cSatipDevice *cSatipDevice::GetSatipDevice(int cardIndexP)
|
cSatipDevice *cSatipDevice::GetSatipDevice(int cardIndexP)
|
||||||
{
|
{
|
||||||
//debug("cSatipDevice::%s(%d)", __FUNCTION__, cardIndexP);
|
//debug("%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("cSatipDevice::%s(%d): found!", __FUNCTION__, cardIndexP);
|
//debug("%s(%d): Found!", __PRETTY_FUNCTION__, cardIndexP);
|
||||||
return SatipDevicesS[i];
|
return SatipDevicesS[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -126,7 +126,7 @@ cString cSatipDevice::GetSatipStatus(void)
|
|||||||
|
|
||||||
cString cSatipDevice::GetGeneralInformation(void)
|
cString cSatipDevice::GetGeneralInformation(void)
|
||||||
{
|
{
|
||||||
//debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM);
|
//debug("%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() : "",
|
||||||
@ -138,13 +138,13 @@ cString cSatipDevice::GetGeneralInformation(void)
|
|||||||
|
|
||||||
cString cSatipDevice::GetPidsInformation(void)
|
cString cSatipDevice::GetPidsInformation(void)
|
||||||
{
|
{
|
||||||
//debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM);
|
//debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||||
return GetPidStatistic();
|
return GetPidStatistic();
|
||||||
}
|
}
|
||||||
|
|
||||||
cString cSatipDevice::GetFiltersInformation(void)
|
cString cSatipDevice::GetFiltersInformation(void)
|
||||||
{
|
{
|
||||||
//debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM);
|
//debug("%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() : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,43 +180,43 @@ cString cSatipDevice::GetInformation(unsigned int pageP)
|
|||||||
|
|
||||||
bool cSatipDevice::Ready(void)
|
bool cSatipDevice::Ready(void)
|
||||||
{
|
{
|
||||||
//debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM);
|
//debug("%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("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM);
|
//debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||||
return "SAT>IP";
|
return "SAT>IP";
|
||||||
}
|
}
|
||||||
|
|
||||||
cString cSatipDevice::DeviceName(void) const
|
cString cSatipDevice::DeviceName(void) const
|
||||||
{
|
{
|
||||||
//debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM);
|
//debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||||
return deviceNameM;
|
return deviceNameM;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cSatipDevice::AvoidRecording(void) const
|
bool cSatipDevice::AvoidRecording(void) const
|
||||||
{
|
{
|
||||||
//debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM);
|
//debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||||
return SatipConfig.IsOperatingModeLow();
|
return SatipConfig.IsOperatingModeLow();
|
||||||
}
|
}
|
||||||
|
|
||||||
int cSatipDevice::SignalStrength(void) const
|
int cSatipDevice::SignalStrength(void) const
|
||||||
{
|
{
|
||||||
//debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM);
|
//debug("%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("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM);
|
//debug("%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("cSatipDevice::%s(%u): source=%c", __FUNCTION__, deviceIndexM, cSource::ToChar(sourceP));
|
//debug("%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) {
|
||||||
@ -230,7 +230,7 @@ bool cSatipDevice::ProvidesSource(int sourceP) const
|
|||||||
|
|
||||||
bool cSatipDevice::ProvidesTransponder(const cChannel *channelP) const
|
bool cSatipDevice::ProvidesTransponder(const cChannel *channelP) const
|
||||||
{
|
{
|
||||||
debug("cSatipDevice::%s(%u): transponder=%d source=%c", __FUNCTION__, deviceIndexM, channelP ? channelP->Transponder() : -1, channelP ? cSource::ToChar(channelP->Source()) : '?');
|
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);
|
||||||
return (ProvidesSource(channelP->Source()));
|
return (ProvidesSource(channelP->Source()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,7 +240,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("cSatipDevice::%s(%u): channel=%d priority=%d", __FUNCTION__, deviceIndexM, channelP ? channelP->Number() : -1, priorityP);
|
debug("%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;
|
||||||
@ -322,7 +322,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("cSatipDevice::%s(%u): no suitable server found", __FUNCTION__, deviceIndexM);
|
debug("%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());
|
||||||
@ -341,7 +341,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("cSatipDevice::%s(%u): pid=%d type=%d on=%d", __FUNCTION__, deviceIndexM, handleP->pid, typeP, onP);
|
//debug("%s(%d, %d, %d) [device %u]", __PRETTY_FUNCTION__, deviceIndexM, 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);
|
||||||
@ -353,7 +353,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("cSatipDevice::%s(%u): pid=%d tid=%d mask=%d", __FUNCTION__, deviceIndexM, pidP, tidP, maskP);
|
//debug("%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))
|
||||||
@ -365,7 +365,7 @@ int cSatipDevice::OpenFilter(u_short pidP, u_char tidP, u_char maskP)
|
|||||||
|
|
||||||
void cSatipDevice::CloseFilter(int handleP)
|
void cSatipDevice::CloseFilter(int handleP)
|
||||||
{
|
{
|
||||||
//debug("cSatipDevice::%s(%u): handle=%d", __FUNCTION__, deviceIndexM, handleP);
|
//debug("%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);
|
||||||
@ -375,7 +375,7 @@ void cSatipDevice::CloseFilter(int handleP)
|
|||||||
|
|
||||||
bool cSatipDevice::OpenDvr(void)
|
bool cSatipDevice::OpenDvr(void)
|
||||||
{
|
{
|
||||||
debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM);
|
debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||||
isPacketDeliveredM = false;
|
isPacketDeliveredM = false;
|
||||||
tsBufferM->Clear();
|
tsBufferM->Clear();
|
||||||
if (pTunerM)
|
if (pTunerM)
|
||||||
@ -386,7 +386,7 @@ bool cSatipDevice::OpenDvr(void)
|
|||||||
|
|
||||||
void cSatipDevice::CloseDvr(void)
|
void cSatipDevice::CloseDvr(void)
|
||||||
{
|
{
|
||||||
debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM);
|
debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||||
if (pTunerM)
|
if (pTunerM)
|
||||||
pTunerM->Close();
|
pTunerM->Close();
|
||||||
isOpenDvrM = false;
|
isOpenDvrM = false;
|
||||||
@ -394,19 +394,19 @@ void cSatipDevice::CloseDvr(void)
|
|||||||
|
|
||||||
bool cSatipDevice::HasLock(int timeoutMsP) const
|
bool cSatipDevice::HasLock(int timeoutMsP) const
|
||||||
{
|
{
|
||||||
//debug("cSatipDevice::%s(%u): timeoutMs=%d", __FUNCTION__, deviceIndexM, timeoutMsP);
|
//debug("%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("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM);
|
//debug("%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("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM);
|
//debug("%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);
|
||||||
@ -420,13 +420,13 @@ void cSatipDevice::WriteData(uchar *bufferP, int lengthP)
|
|||||||
|
|
||||||
int cSatipDevice::GetId(void)
|
int cSatipDevice::GetId(void)
|
||||||
{
|
{
|
||||||
//debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM);
|
//debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||||
return deviceIndexM;
|
return deviceIndexM;
|
||||||
}
|
}
|
||||||
|
|
||||||
uchar *cSatipDevice::GetData(int *availableP)
|
uchar *cSatipDevice::GetData(int *availableP)
|
||||||
{
|
{
|
||||||
//debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM);
|
//debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||||
if (isOpenDvrM && tsBufferM) {
|
if (isOpenDvrM && tsBufferM) {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
if (isPacketDeliveredM)
|
if (isPacketDeliveredM)
|
||||||
@ -457,7 +457,7 @@ uchar *cSatipDevice::GetData(int *availableP)
|
|||||||
|
|
||||||
void cSatipDevice::SkipData(int countP)
|
void cSatipDevice::SkipData(int countP)
|
||||||
{
|
{
|
||||||
//debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM);
|
//debug("%s [device %u]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||||
tsBufferM->Del(countP);
|
tsBufferM->Del(countP);
|
||||||
isPacketDeliveredM = false;
|
isPacketDeliveredM = false;
|
||||||
// Update buffer statistics
|
// Update buffer statistics
|
||||||
@ -466,7 +466,7 @@ void cSatipDevice::SkipData(int countP)
|
|||||||
|
|
||||||
bool cSatipDevice::GetTSPacket(uchar *&dataP)
|
bool cSatipDevice::GetTSPacket(uchar *&dataP)
|
||||||
{
|
{
|
||||||
//debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM);
|
//debug("%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()) {
|
||||||
|
50
discover.c
50
discover.c
@ -27,7 +27,7 @@ cSatipDiscover *cSatipDiscover::GetInstance(void)
|
|||||||
|
|
||||||
bool cSatipDiscover::Initialize(cSatipDiscoverServers *serversP)
|
bool cSatipDiscover::Initialize(cSatipDiscoverServers *serversP)
|
||||||
{
|
{
|
||||||
debug("cSatipDiscover::%s()", __FUNCTION__);
|
debug("%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))
|
||||||
@ -41,7 +41,7 @@ bool cSatipDiscover::Initialize(cSatipDiscoverServers *serversP)
|
|||||||
|
|
||||||
void cSatipDiscover::Destroy(void)
|
void cSatipDiscover::Destroy(void)
|
||||||
{
|
{
|
||||||
debug("cSatipDiscover::%s()", __FUNCTION__);
|
debug("%s", __PRETTY_FUNCTION__);
|
||||||
if (instanceS)
|
if (instanceS)
|
||||||
instanceS->Deactivate();
|
instanceS->Deactivate();
|
||||||
}
|
}
|
||||||
@ -50,7 +50,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("cSatipDiscover::%s(%zu)", __FUNCTION__, len);
|
//debug("%s len=%zu", __PRETTY_FUNCTION__, len);
|
||||||
|
|
||||||
if (obj) {
|
if (obj) {
|
||||||
CURLcode res = CURLE_OK;
|
CURLcode res = CURLE_OK;
|
||||||
@ -94,19 +94,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("cSatipDiscover::%s(): HTTP INFO %.*s", __FUNCTION__, (int)sizeP, dataP);
|
extra("%s HTTP INFO %.*s", __PRETTY_FUNCTION__, (int)sizeP, dataP);
|
||||||
break;
|
break;
|
||||||
case CURLINFO_HEADER_IN:
|
case CURLINFO_HEADER_IN:
|
||||||
extra("cSatipDiscover::%s(): HTTP HEAD <<< %.*s", __FUNCTION__, (int)sizeP, dataP);
|
extra("%s HTTP HEAD <<< %.*s", __PRETTY_FUNCTION__, (int)sizeP, dataP);
|
||||||
break;
|
break;
|
||||||
case CURLINFO_HEADER_OUT:
|
case CURLINFO_HEADER_OUT:
|
||||||
extra("cSatipDiscover::%s(): HTTP HEAD >>>\n%.*s", __FUNCTION__, (int)sizeP, dataP);
|
extra("%s HTTP HEAD >>>\n%.*s", __PRETTY_FUNCTION__, (int)sizeP, dataP);
|
||||||
break;
|
break;
|
||||||
case CURLINFO_DATA_IN:
|
case CURLINFO_DATA_IN:
|
||||||
extra("cSatipDiscover::%s(): HTTP DATA <<< %.*s", __FUNCTION__, (int)sizeP, dataP);
|
extra("%s HTTP DATA <<< %.*s", __PRETTY_FUNCTION__, (int)sizeP, dataP);
|
||||||
break;
|
break;
|
||||||
case CURLINFO_DATA_OUT:
|
case CURLINFO_DATA_OUT:
|
||||||
extra("cSatipDiscover::%s(): HTTP DATA >>>\n%.*s", __FUNCTION__, (int)sizeP, dataP);
|
extra("%s HTTP DATA >>>\n%.*s", __PRETTY_FUNCTION__, (int)sizeP, dataP);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -126,12 +126,12 @@ cSatipDiscover::cSatipDiscover()
|
|||||||
probeIntervalM(0),
|
probeIntervalM(0),
|
||||||
serversM()
|
serversM()
|
||||||
{
|
{
|
||||||
debug("cSatipDiscover::%s()", __FUNCTION__);
|
debug("%s", __PRETTY_FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
cSatipDiscover::~cSatipDiscover()
|
cSatipDiscover::~cSatipDiscover()
|
||||||
{
|
{
|
||||||
debug("cSatipDiscover::%s()", __FUNCTION__);
|
debug("%s", __PRETTY_FUNCTION__);
|
||||||
Deactivate();
|
Deactivate();
|
||||||
cMutexLock MutexLock(&mutexM);
|
cMutexLock MutexLock(&mutexM);
|
||||||
// Free allocated memory
|
// Free allocated memory
|
||||||
@ -149,7 +149,7 @@ void cSatipDiscover::Activate(void)
|
|||||||
|
|
||||||
void cSatipDiscover::Deactivate(void)
|
void cSatipDiscover::Deactivate(void)
|
||||||
{
|
{
|
||||||
debug("cSatipDiscover::%s()", __FUNCTION__);
|
debug("%s", __PRETTY_FUNCTION__);
|
||||||
cMutexLock MutexLock(&mutexM);
|
cMutexLock MutexLock(&mutexM);
|
||||||
sleepM.Signal();
|
sleepM.Signal();
|
||||||
if (Running())
|
if (Running())
|
||||||
@ -158,7 +158,7 @@ void cSatipDiscover::Deactivate(void)
|
|||||||
|
|
||||||
void cSatipDiscover::Action(void)
|
void cSatipDiscover::Action(void)
|
||||||
{
|
{
|
||||||
debug("cSatipDiscover::%s(): entering", __FUNCTION__);
|
debug("%s Entering", __PRETTY_FUNCTION__);
|
||||||
probeIntervalM.Set(eProbeIntervalMs);
|
probeIntervalM.Set(eProbeIntervalMs);
|
||||||
msearchM.Probe();
|
msearchM.Probe();
|
||||||
// Do the thread loop
|
// Do the thread loop
|
||||||
@ -187,12 +187,12 @@ 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("cSatipDiscover::%s(): exiting", __FUNCTION__);
|
debug("%s Exiting", __PRETTY_FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cSatipDiscover::Fetch(const char *urlP)
|
void cSatipDiscover::Fetch(const char *urlP)
|
||||||
{
|
{
|
||||||
debug("cSatipDiscover::%s(%s)", __FUNCTION__, urlP);
|
debug("%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;
|
||||||
@ -232,7 +232,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("cSatipDiscover::%s(%s, %s, %s)", __FUNCTION__, addrP, modelP, descP);
|
debug("%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
|
||||||
@ -246,70 +246,70 @@ void cSatipDiscover::AddServer(const char *addrP, const char *modelP, const char
|
|||||||
|
|
||||||
int cSatipDiscover::GetServerCount(void)
|
int cSatipDiscover::GetServerCount(void)
|
||||||
{
|
{
|
||||||
//debug("cSatipDiscover::%s()", __FUNCTION__);
|
//debug("%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("cSatipDiscover::%s(%d, %d, %d)", __FUNCTION__, sourceP, transponderP, systemP);
|
//debug("%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("cSatipDiscover::%s()", __FUNCTION__);
|
//debug("%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("cSatipDiscover::%s()", __FUNCTION__);
|
//debug("%s", __PRETTY_FUNCTION__);
|
||||||
cMutexLock MutexLock(&mutexM);
|
cMutexLock MutexLock(&mutexM);
|
||||||
return &serversM;
|
return &serversM;
|
||||||
}
|
}
|
||||||
|
|
||||||
cString cSatipDiscover::GetServerString(cSatipServer *serverP)
|
cString cSatipDiscover::GetServerString(cSatipServer *serverP)
|
||||||
{
|
{
|
||||||
//debug("cSatipDiscover::%s()", __FUNCTION__);
|
//debug("%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("cSatipDiscover::%s()", __FUNCTION__);
|
//debug("%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("cSatipDiscover::%s(%d)", __FUNCTION__, transponderP);
|
//debug("%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("cSatipDiscover::%s(%d)", __FUNCTION__, onOffP);
|
//debug("%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("cSatipDiscover::%s()", __FUNCTION__);
|
//debug("%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("cSatipDiscover::%s(%s)", __FUNCTION__, urlP);
|
//debug("%s(%s)", __PRETTY_FUNCTION__, urlP);
|
||||||
mutexM.Lock();
|
mutexM.Lock();
|
||||||
probeUrlListM.Insert(strdup(urlP));
|
probeUrlListM.Insert(strdup(urlP));
|
||||||
mutexM.Unlock();
|
mutexM.Unlock();
|
||||||
|
12
msearch.c
12
msearch.c
@ -38,7 +38,7 @@ cSatipMsearch::~cSatipMsearch()
|
|||||||
|
|
||||||
void cSatipMsearch::Probe(void)
|
void cSatipMsearch::Probe(void)
|
||||||
{
|
{
|
||||||
debug("cSatipMsearch::%s()", __FUNCTION__);
|
debug("%s", __PRETTY_FUNCTION__);
|
||||||
if (!registeredM) {
|
if (!registeredM) {
|
||||||
cSatipPoller::GetInstance()->Register(*this);
|
cSatipPoller::GetInstance()->Register(*this);
|
||||||
registeredM = true;
|
registeredM = true;
|
||||||
@ -53,17 +53,17 @@ int cSatipMsearch::GetFd(void)
|
|||||||
|
|
||||||
void cSatipMsearch::Process(void)
|
void cSatipMsearch::Process(void)
|
||||||
{
|
{
|
||||||
//debug("cSatipMsearch::%s()", __FUNCTION__);
|
//debug("%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("cSatipMsearch::%s(): len=%d buf=%s", __FUNCTION__, length, bufferM);
|
//debug("%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("cSatipMsearch::%s(): %s", __FUNCTION__, r);
|
//debug("%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"))
|
||||||
@ -73,7 +73,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("cSatipMsearch::%s(): location='%s'", __FUNCTION__, location);
|
debug("%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
|
||||||
@ -81,7 +81,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("cSatipMsearch::%s(): st='%s'", __FUNCTION__, st);
|
debug("%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
@ -24,7 +24,7 @@ cSatipPoller *cSatipPoller::GetInstance(void)
|
|||||||
|
|
||||||
bool cSatipPoller::Initialize(void)
|
bool cSatipPoller::Initialize(void)
|
||||||
{
|
{
|
||||||
debug("cSatipPoller::%s()", __FUNCTION__);
|
debug("%s", __PRETTY_FUNCTION__);
|
||||||
if (instanceS)
|
if (instanceS)
|
||||||
instanceS->Activate();
|
instanceS->Activate();
|
||||||
return true;
|
return true;
|
||||||
@ -32,7 +32,7 @@ bool cSatipPoller::Initialize(void)
|
|||||||
|
|
||||||
void cSatipPoller::Destroy(void)
|
void cSatipPoller::Destroy(void)
|
||||||
{
|
{
|
||||||
debug("cSatipPoller::%s()", __FUNCTION__);
|
debug("%s", __PRETTY_FUNCTION__);
|
||||||
if (instanceS)
|
if (instanceS)
|
||||||
instanceS->Deactivate();
|
instanceS->Deactivate();
|
||||||
}
|
}
|
||||||
@ -42,12 +42,12 @@ cSatipPoller::cSatipPoller()
|
|||||||
mutexM(),
|
mutexM(),
|
||||||
fdM(epoll_create(eMaxFileDescriptors))
|
fdM(epoll_create(eMaxFileDescriptors))
|
||||||
{
|
{
|
||||||
debug("cSatipPoller::%s()", __FUNCTION__);
|
debug("%s", __PRETTY_FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
cSatipPoller::~cSatipPoller()
|
cSatipPoller::~cSatipPoller()
|
||||||
{
|
{
|
||||||
debug("cSatipPoller::%s()", __FUNCTION__);
|
debug("%s", __PRETTY_FUNCTION__);
|
||||||
Deactivate();
|
Deactivate();
|
||||||
cMutexLock MutexLock(&mutexM);
|
cMutexLock MutexLock(&mutexM);
|
||||||
close(fdM);
|
close(fdM);
|
||||||
@ -62,7 +62,7 @@ void cSatipPoller::Activate(void)
|
|||||||
|
|
||||||
void cSatipPoller::Deactivate(void)
|
void cSatipPoller::Deactivate(void)
|
||||||
{
|
{
|
||||||
debug("cSatipPoller::%s()", __FUNCTION__);
|
debug("%s", __PRETTY_FUNCTION__);
|
||||||
cMutexLock MutexLock(&mutexM);
|
cMutexLock MutexLock(&mutexM);
|
||||||
if (Running())
|
if (Running())
|
||||||
Cancel(3);
|
Cancel(3);
|
||||||
@ -70,7 +70,7 @@ void cSatipPoller::Deactivate(void)
|
|||||||
|
|
||||||
void cSatipPoller::Action(void)
|
void cSatipPoller::Action(void)
|
||||||
{
|
{
|
||||||
debug("cSatipPoller::%s(): entering", __FUNCTION__);
|
debug("%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
|
||||||
@ -88,34 +88,34 @@ void cSatipPoller::Action(void)
|
|||||||
elapsed = processing.Elapsed();
|
elapsed = processing.Elapsed();
|
||||||
if (elapsed > maxElapsed) {
|
if (elapsed > maxElapsed) {
|
||||||
maxElapsed = elapsed;
|
maxElapsed = elapsed;
|
||||||
debug("cSatipPoller::%s(): Processing %s took %" PRIu64 " ms", __FUNCTION__, *(poll->ToString()), maxElapsed);
|
debug("%s Processing %s took %" PRIu64 " ms", __PRETTY_FUNCTION__, *(poll->ToString()), maxElapsed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
debug("cSatipPoller::%s(): exiting", __FUNCTION__);
|
debug("%s Exiting", __PRETTY_FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cSatipPoller::Register(cSatipPollerIf &pollerP)
|
bool cSatipPoller::Register(cSatipPollerIf &pollerP)
|
||||||
{
|
{
|
||||||
debug("cSatipPoller::%s(%d)", __FUNCTION__, pollerP.GetFd());
|
debug("%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("cSatipPoller::%s(%d): Added interface", __FUNCTION__, pollerP.GetFd());
|
debug("%s Added interface fd=%d", __PRETTY_FUNCTION__, pollerP.GetFd());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cSatipPoller::Unregister(cSatipPollerIf &pollerP)
|
bool cSatipPoller::Unregister(cSatipPollerIf &pollerP)
|
||||||
{
|
{
|
||||||
debug("cSatipPoller::%s(%d)", __FUNCTION__, pollerP.GetFd());
|
debug("%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("cSatipPoller::%s(%d): Removed interface", __FUNCTION__, pollerP.GetFd());
|
debug("%s Removed interface fd=%d", __PRETTY_FUNCTION__, pollerP.GetFd());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
10
rtcp.c
10
rtcp.c
@ -14,7 +14,7 @@ cSatipRtcp::cSatipRtcp(cSatipTunerIf &tunerP, unsigned int bufferLenP)
|
|||||||
bufferLenM(bufferLenP),
|
bufferLenM(bufferLenP),
|
||||||
bufferM(MALLOC(unsigned char, bufferLenM))
|
bufferM(MALLOC(unsigned char, bufferLenM))
|
||||||
{
|
{
|
||||||
debug("cSatipRtcp::%s(%u) [device %d]", __FUNCTION__, bufferLenP, tunerM.GetId());
|
debug("%s(, %u) [device %d]", __PRETTY_FUNCTION__, bufferLenP, tunerM.GetId());
|
||||||
if (bufferM)
|
if (bufferM)
|
||||||
memset(bufferM, 0, bufferLenM);
|
memset(bufferM, 0, bufferLenM);
|
||||||
else
|
else
|
||||||
@ -23,19 +23,19 @@ cSatipRtcp::cSatipRtcp(cSatipTunerIf &tunerP, unsigned int bufferLenP)
|
|||||||
|
|
||||||
cSatipRtcp::~cSatipRtcp()
|
cSatipRtcp::~cSatipRtcp()
|
||||||
{
|
{
|
||||||
debug("cSatipRtcp::%s() [device %d]", __FUNCTION__, tunerM.GetId());
|
debug("%s [device %d]", __PRETTY_FUNCTION__, tunerM.GetId());
|
||||||
DELETE_POINTER(bufferM);
|
DELETE_POINTER(bufferM);
|
||||||
}
|
}
|
||||||
|
|
||||||
int cSatipRtcp::GetFd(void)
|
int cSatipRtcp::GetFd(void)
|
||||||
{
|
{
|
||||||
//debug("cSatipRtcp::%s() [device %d]", __FUNCTION__, tunerM.GetId());
|
//debug("%s [device %d]", __PRETTY_FUNCTION__, tunerM.GetId());
|
||||||
return Fd();
|
return Fd();
|
||||||
}
|
}
|
||||||
|
|
||||||
int cSatipRtcp::GetApplicationOffset(int *lengthP)
|
int cSatipRtcp::GetApplicationOffset(int *lengthP)
|
||||||
{
|
{
|
||||||
//debug("cSatipRtcp::%s(%d) [device %d]", __FUNCTION__, *lengthP, tunerM.GetId());
|
//debug("%s(%d) [device %d]", __PRETTY_FUNCTION__, *lengthP, tunerM.GetId());
|
||||||
if (!lengthP)
|
if (!lengthP)
|
||||||
return -1;
|
return -1;
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
@ -80,7 +80,7 @@ int cSatipRtcp::GetApplicationOffset(int *lengthP)
|
|||||||
|
|
||||||
void cSatipRtcp::Process(void)
|
void cSatipRtcp::Process(void)
|
||||||
{
|
{
|
||||||
//debug("cSatipRtcp::%s() [device %d]", __FUNCTION__, tunerM.GetId());
|
//debug("%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) {
|
||||||
|
18
rtp.c
18
rtp.c
@ -17,7 +17,7 @@ cSatipRtp::cSatipRtp(cSatipTunerIf &tunerP, unsigned int bufferLenP)
|
|||||||
packetErrorsM(0),
|
packetErrorsM(0),
|
||||||
sequenceNumberM(-1)
|
sequenceNumberM(-1)
|
||||||
{
|
{
|
||||||
debug("cSatipRtp::%s(%u) [device %d]", __FUNCTION__, bufferLenP, tunerM.GetId());
|
debug("%s(, %u) [device %d]", __PRETTY_FUNCTION__, bufferLenP, tunerM.GetId());
|
||||||
if (bufferM)
|
if (bufferM)
|
||||||
memset(bufferM, 0, bufferLenM);
|
memset(bufferM, 0, bufferLenM);
|
||||||
else
|
else
|
||||||
@ -26,7 +26,7 @@ cSatipRtp::cSatipRtp(cSatipTunerIf &tunerP, unsigned int bufferLenP)
|
|||||||
|
|
||||||
cSatipRtp::~cSatipRtp()
|
cSatipRtp::~cSatipRtp()
|
||||||
{
|
{
|
||||||
debug("cSatipRtp::%s() [device %d]", __FUNCTION__, tunerM.GetId());
|
debug("%s [device %d]", __PRETTY_FUNCTION__, tunerM.GetId());
|
||||||
DELETE_POINTER(bufferM);
|
DELETE_POINTER(bufferM);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,13 +37,13 @@ int cSatipRtp::GetFd(void)
|
|||||||
|
|
||||||
void cSatipRtp::Close(void)
|
void cSatipRtp::Close(void)
|
||||||
{
|
{
|
||||||
debug("cSatipRtp::%s() [device %d]", __FUNCTION__, tunerM.GetId());
|
debug("%s [device %d]", __PRETTY_FUNCTION__, tunerM.GetId());
|
||||||
|
|
||||||
cSatipSocket::Close();
|
cSatipSocket::Close();
|
||||||
|
|
||||||
sequenceNumberM = -1;
|
sequenceNumberM = -1;
|
||||||
if (packetErrorsM) {
|
if (packetErrorsM) {
|
||||||
info("Detected %d RTP packet errors", packetErrorsM);
|
info("Detected %d RTP packet errors [device %d]", packetErrorsM, tunerM.GetId());
|
||||||
packetErrorsM = 0;
|
packetErrorsM = 0;
|
||||||
lastErrorReportM = time(NULL);
|
lastErrorReportM = time(NULL);
|
||||||
}
|
}
|
||||||
@ -51,7 +51,7 @@ void cSatipRtp::Close(void)
|
|||||||
|
|
||||||
int cSatipRtp::GetHeaderLenght(unsigned int lengthP)
|
int cSatipRtp::GetHeaderLenght(unsigned int lengthP)
|
||||||
{
|
{
|
||||||
//debug("cSatipRtp::%s(%d) [device %d]", __FUNCTION__, lengthP, tunerM.GetId());
|
//debug("%s(%d) [device %d]", __PRETTY_FUNCTION__, lengthP, tunerM.GetId());
|
||||||
unsigned int headerlen = 0;
|
unsigned int headerlen = 0;
|
||||||
|
|
||||||
if (lengthP > 0) {
|
if (lengthP > 0) {
|
||||||
@ -94,12 +94,12 @@ int cSatipRtp::GetHeaderLenght(unsigned int lengthP)
|
|||||||
}
|
}
|
||||||
// Check for empty payload
|
// Check for empty payload
|
||||||
if (lengthP == headerlen) {
|
if (lengthP == headerlen) {
|
||||||
debug("cSatipRtp::%s(%d): Received empty RTP packet #%d [device %d]", __FUNCTION__, lengthP, seq, tunerM.GetId());
|
debug("%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("cSatipRtp::%s(%d): Received incorrect RTP packet #%d v=%d len=%d sync=0x%02X [device %d]", __FUNCTION__, lengthP, seq, v, headerlen, bufferM[headerlen], tunerM.GetId());
|
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());
|
||||||
headerlen = -1;
|
headerlen = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -110,7 +110,7 @@ int cSatipRtp::GetHeaderLenght(unsigned int lengthP)
|
|||||||
|
|
||||||
void cSatipRtp::Process(void)
|
void cSatipRtp::Process(void)
|
||||||
{
|
{
|
||||||
//debug("cSatipRtp::%s() [device %d]", __FUNCTION__, tunerM.GetId());
|
//debug("%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) {
|
||||||
@ -119,7 +119,7 @@ void cSatipRtp::Process(void)
|
|||||||
tunerM.ProcessVideoData(bufferM + headerlen, length - headerlen);
|
tunerM.ProcessVideoData(bufferM + headerlen, length - headerlen);
|
||||||
}
|
}
|
||||||
if (errno != EAGAIN && errno != EWOULDBLOCK)
|
if (errno != EAGAIN && errno != EWOULDBLOCK)
|
||||||
error("Error %d reading in %s", errno, *ToString());
|
error("Error %d reading in %s [device %d]", errno, *ToString(), tunerM.GetId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
38
rtsp.c
38
rtsp.c
@ -14,7 +14,7 @@ cSatipRtsp::cSatipRtsp(cSatipTunerIf &tunerP)
|
|||||||
handleM(curl_easy_init()),
|
handleM(curl_easy_init()),
|
||||||
headerListM(NULL)
|
headerListM(NULL)
|
||||||
{
|
{
|
||||||
debug("cSatipRtsp::%s() [device %d]", __FUNCTION__, tunerM.GetId());
|
debug("%s [device %d]", __PRETTY_FUNCTION__, tunerM.GetId());
|
||||||
|
|
||||||
if (handleM) {
|
if (handleM) {
|
||||||
CURLcode res = CURLE_OK;
|
CURLcode res = CURLE_OK;
|
||||||
@ -41,7 +41,7 @@ cSatipRtsp::cSatipRtsp(cSatipTunerIf &tunerP)
|
|||||||
|
|
||||||
cSatipRtsp::~cSatipRtsp()
|
cSatipRtsp::~cSatipRtsp()
|
||||||
{
|
{
|
||||||
debug("cSatipRtsp::%s() [device %d]", __FUNCTION__, tunerM.GetId());
|
debug("%s [device %d]", __PRETTY_FUNCTION__, tunerM.GetId());
|
||||||
|
|
||||||
if (handleM) {
|
if (handleM) {
|
||||||
// Cleanup curl stuff
|
// Cleanup curl stuff
|
||||||
@ -58,13 +58,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("cSatipRtsp::%s(%zu)", __FUNCTION__, len);
|
//debug("%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("cSatipRtsp::%s(%zu): %s", __FUNCTION__, len, r);
|
//debug("%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;
|
||||||
@ -90,7 +90,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("cSatipRtsp::%s(%zu)", __FUNCTION__, len);
|
//debug("%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);
|
||||||
@ -105,19 +105,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("cSatipRtsp::%s(): [device %d] RTSP INFO %.*s", __FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP);
|
extra("%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("cSatipRtsp::%s(): [device %d] RTSP HEAD <<< %.*s", __FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP);
|
extra("%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("cSatipRtsp::%s(): [device %d] RTSP HEAD >>>\n%.*s", __FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP);
|
extra("%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("cSatipRtsp::%s(): [device %d] RTSP DATA <<< %.*s", __FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP);
|
extra("%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("cSatipRtsp::%s(): [device %d] RTSP DATA >>>\n%.*s", __FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP);
|
extra("%s [device %d] RTSP DATA >>>\n%.*s", __PRETTY_FUNCTION__, obj->tunerM.GetId(), (int)sizeP, dataP);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -129,7 +129,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("cSatipRtsp::%s(%s) [device %d]", __FUNCTION__, strP, tunerM.GetId());
|
debug("%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;
|
||||||
@ -143,7 +143,7 @@ cString cSatipRtsp::RtspUnescapeString(const char *strP)
|
|||||||
|
|
||||||
bool cSatipRtsp::Options(const char *uriP)
|
bool cSatipRtsp::Options(const char *uriP)
|
||||||
{
|
{
|
||||||
debug("cSatipRtsp::%s(%s) [device %d]", __FUNCTION__, uriP, tunerM.GetId());
|
debug("%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;
|
||||||
|
|
||||||
@ -161,7 +161,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("cSatipRtsp::%s(%s, %d, %d) [device %d]", __FUNCTION__, uriP, rtpPortP, rtcpPortP, tunerM.GetId());
|
debug("%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);
|
||||||
@ -186,11 +186,11 @@ bool cSatipRtsp::Setup(const char *uriP, int rtpPortP, int rtcpPortP)
|
|||||||
|
|
||||||
bool cSatipRtsp::SetSession(const char *sessionP)
|
bool cSatipRtsp::SetSession(const char *sessionP)
|
||||||
{
|
{
|
||||||
debug("cSatipRtsp::%s(%s) [device %d]", __FUNCTION__, sessionP, tunerM.GetId());
|
debug("%s(%s) [device %d]", __PRETTY_FUNCTION__, sessionP, tunerM.GetId());
|
||||||
if (handleM) {
|
if (handleM) {
|
||||||
CURLcode res = CURLE_OK;
|
CURLcode res = CURLE_OK;
|
||||||
|
|
||||||
debug("cSatipRtsp::%s(): session id quirk enabled [device %d]", __FUNCTION__, tunerM.GetId());
|
debug("%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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,7 +199,7 @@ bool cSatipRtsp::SetSession(const char *sessionP)
|
|||||||
|
|
||||||
bool cSatipRtsp::Describe(const char *uriP)
|
bool cSatipRtsp::Describe(const char *uriP)
|
||||||
{
|
{
|
||||||
debug("cSatipRtsp::%s(%s) [device %d]", __FUNCTION__, uriP, tunerM.GetId());
|
debug("%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;
|
||||||
|
|
||||||
@ -219,7 +219,7 @@ bool cSatipRtsp::Describe(const char *uriP)
|
|||||||
|
|
||||||
bool cSatipRtsp::Play(const char *uriP)
|
bool cSatipRtsp::Play(const char *uriP)
|
||||||
{
|
{
|
||||||
debug("cSatipRtsp::%s(%s) [device %d]", __FUNCTION__, uriP, tunerM.GetId());
|
debug("%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;
|
||||||
|
|
||||||
@ -235,7 +235,7 @@ bool cSatipRtsp::Play(const char *uriP)
|
|||||||
|
|
||||||
bool cSatipRtsp::Teardown(const char *uriP)
|
bool cSatipRtsp::Teardown(const char *uriP)
|
||||||
{
|
{
|
||||||
debug("cSatipRtsp::%s(%s) [device %d]", __FUNCTION__, uriP, tunerM.GetId());
|
debug("%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;
|
||||||
|
|
||||||
@ -267,7 +267,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("cSatipRtsp::%s(): %s [device %d]", __FUNCTION__, result ? "ok" : "failed", tunerM.GetId());
|
debug("%s result=%s [device %d]", __PRETTY_FUNCTION__, result ? "ok" : "failed", tunerM.GetId());
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
50
satip.c
50
satip.c
@ -63,7 +63,7 @@ cPluginSatip::cPluginSatip(void)
|
|||||||
: deviceCountM(1),
|
: deviceCountM(1),
|
||||||
serversM(NULL)
|
serversM(NULL)
|
||||||
{
|
{
|
||||||
//debug("cPluginSatip::%s()", __FUNCTION__);
|
//debug("%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!
|
||||||
@ -71,13 +71,13 @@ cPluginSatip::cPluginSatip(void)
|
|||||||
|
|
||||||
cPluginSatip::~cPluginSatip()
|
cPluginSatip::~cPluginSatip()
|
||||||
{
|
{
|
||||||
//debug("cPluginSatip::%s()", __FUNCTION__);
|
//debug("%s", __PRETTY_FUNCTION__);
|
||||||
// Clean up after yourself!
|
// Clean up after yourself!
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *cPluginSatip::CommandLineHelp(void)
|
const char *cPluginSatip::CommandLineHelp(void)
|
||||||
{
|
{
|
||||||
debug("cPluginSatip::%s()", __FUNCTION__);
|
debug("%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"
|
||||||
@ -86,7 +86,7 @@ const char *cPluginSatip::CommandLineHelp(void)
|
|||||||
|
|
||||||
bool cPluginSatip::ProcessArgs(int argc, char *argv[])
|
bool cPluginSatip::ProcessArgs(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
debug("cPluginSatip::%s()", __FUNCTION__);
|
debug("%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' },
|
||||||
@ -116,7 +116,7 @@ bool cPluginSatip::ProcessArgs(int argc, char *argv[])
|
|||||||
|
|
||||||
bool cPluginSatip::Initialize(void)
|
bool cPluginSatip::Initialize(void)
|
||||||
{
|
{
|
||||||
debug("cPluginSatip::%s()", __FUNCTION__);
|
debug("%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");
|
||||||
@ -128,7 +128,7 @@ bool cPluginSatip::Initialize(void)
|
|||||||
|
|
||||||
bool cPluginSatip::Start(void)
|
bool cPluginSatip::Start(void)
|
||||||
{
|
{
|
||||||
debug("cPluginSatip::%s()", __FUNCTION__);
|
debug("%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);
|
||||||
@ -143,7 +143,7 @@ bool cPluginSatip::Start(void)
|
|||||||
|
|
||||||
void cPluginSatip::Stop(void)
|
void cPluginSatip::Stop(void)
|
||||||
{
|
{
|
||||||
debug("cPluginSatip::%s()", __FUNCTION__);
|
debug("%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();
|
||||||
@ -153,60 +153,60 @@ void cPluginSatip::Stop(void)
|
|||||||
|
|
||||||
void cPluginSatip::Housekeeping(void)
|
void cPluginSatip::Housekeeping(void)
|
||||||
{
|
{
|
||||||
//debug("cPluginSatip::%s()", __FUNCTION__);
|
//debug("%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("cPluginSatip::%s()", __FUNCTION__);
|
//debug("%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("cPluginSatip::%s()", __FUNCTION__);
|
//debug("%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("cPluginSatip::%s()", __FUNCTION__);
|
//debug("%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("cPluginSatip::%s()", __FUNCTION__);
|
//debug("%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("cPluginSatip::%s()", __FUNCTION__);
|
debug("%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("cPluginSatip::%s(%s)", __FUNCTION__, paramP);
|
debug("%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("cPluginSatip::%s(): server[%d]=%s", __FUNCTION__, n, r);
|
//debug("%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("cPluginSatip::%s(): param[%d]=%s", __FUNCTION__, n2, r2);
|
//debug("%s param[%d]=%s", __PRETTY_FUNCTION__, n2, r2);
|
||||||
switch (n2++) {
|
switch (n2++) {
|
||||||
case 0:
|
case 0:
|
||||||
serverAddr = r2;
|
serverAddr = r2;
|
||||||
@ -223,7 +223,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("cPluginSatip::%s(): ipaddr=%s model=%s desc=%s", __FUNCTION__, *serverAddr, *serverModel, *serverDescription);
|
debug("%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));
|
||||||
@ -235,13 +235,13 @@ void cPluginSatip::ParseServer(const char *paramP)
|
|||||||
|
|
||||||
int cPluginSatip::ParseSources(const char *valueP, int *sourcesP)
|
int cPluginSatip::ParseSources(const char *valueP, int *sourcesP)
|
||||||
{
|
{
|
||||||
debug("cPluginSatip::%s(%s)", __FUNCTION__, valueP);
|
debug("%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("cPluginSatip::%s(): sources[%d]=%s", __FUNCTION__, n, r);
|
debug("%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);
|
||||||
}
|
}
|
||||||
@ -252,13 +252,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("cPluginSatip::%s(%s)", __FUNCTION__, valueP);
|
debug("%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("cPluginSatip::%s(): filters[%d]=%d", __FUNCTION__, n, i);
|
//debug(":%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)
|
||||||
@ -269,7 +269,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("cPluginSatip::%s()", __FUNCTION__);
|
debug("%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));
|
||||||
@ -298,13 +298,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("cPluginSatip::%s()", __FUNCTION__);
|
debug("%s", __PRETTY_FUNCTION__);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char **cPluginSatip::SVDRPHelpPages(void)
|
const char **cPluginSatip::SVDRPHelpPages(void)
|
||||||
{
|
{
|
||||||
debug("cPluginSatip::%s()", __FUNCTION__);
|
debug("%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"
|
||||||
@ -329,7 +329,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("cPluginSatip::%s(%s, %s)", __FUNCTION__, commandP, optionP);
|
debug("%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;
|
||||||
|
@ -20,7 +20,7 @@ cSatipSectionFilter::cSatipSectionFilter(int deviceIndexP, uint16_t pidP, uint8_
|
|||||||
ringBufferM(new cRingBufferFrame(eDmxMaxSectionCount * eDmxMaxSectionSize)),
|
ringBufferM(new cRingBufferFrame(eDmxMaxSectionCount * eDmxMaxSectionSize)),
|
||||||
deviceIndexM(deviceIndexP)
|
deviceIndexM(deviceIndexP)
|
||||||
{
|
{
|
||||||
//debug("cSatipSectionFilter::%s(%d, %d)", __FUNCTION__, deviceIndexM, pidM);
|
//debug("%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));
|
||||||
@ -61,7 +61,7 @@ cSatipSectionFilter::cSatipSectionFilter(int deviceIndexP, uint16_t pidP, uint8_
|
|||||||
|
|
||||||
cSatipSectionFilter::~cSatipSectionFilter()
|
cSatipSectionFilter::~cSatipSectionFilter()
|
||||||
{
|
{
|
||||||
//debug("cSatipSectionFilter::%s(%d, %d)", __FUNCTION__, deviceIndexM, pidM);
|
//debug("%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)
|
||||||
@ -236,7 +236,7 @@ cSatipSectionFilterHandler::cSatipSectionFilterHandler(int deviceIndexP, unsigne
|
|||||||
mutexM(),
|
mutexM(),
|
||||||
deviceIndexM(deviceIndexP)
|
deviceIndexM(deviceIndexP)
|
||||||
{
|
{
|
||||||
debug("cSatipSectionFilterHandler::%s(%d)", __FUNCTION__, deviceIndexM);
|
debug("%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));
|
||||||
@ -247,14 +247,14 @@ cSatipSectionFilterHandler::cSatipSectionFilterHandler(int deviceIndexP, unsigne
|
|||||||
ringBufferM->SetIoThrottle();
|
ringBufferM->SetIoThrottle();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
error("Failed to allocate buffer for section filter handler (device=%d): ", deviceIndexM);
|
error("Failed to allocate buffer for section filter handler [device=%d]", deviceIndexM);
|
||||||
|
|
||||||
Start();
|
Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
cSatipSectionFilterHandler::~cSatipSectionFilterHandler()
|
cSatipSectionFilterHandler::~cSatipSectionFilterHandler()
|
||||||
{
|
{
|
||||||
debug("cSatipSectionFilterHandler::%s(%d)", __FUNCTION__, deviceIndexM);
|
debug("%s [device %d]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||||
// Stop thread
|
// Stop thread
|
||||||
if (Running())
|
if (Running())
|
||||||
Cancel(3);
|
Cancel(3);
|
||||||
@ -268,7 +268,7 @@ cSatipSectionFilterHandler::~cSatipSectionFilterHandler()
|
|||||||
|
|
||||||
void cSatipSectionFilterHandler::Action(void)
|
void cSatipSectionFilterHandler::Action(void)
|
||||||
{
|
{
|
||||||
debug("cSatipSectionFilterHandler::%s(%d): entering", __FUNCTION__, deviceIndexM);
|
debug("%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()) {
|
||||||
@ -299,7 +299,7 @@ void cSatipSectionFilterHandler::Action(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ringBufferM->Del(len);
|
ringBufferM->Del(len);
|
||||||
debug("cSatipSectionFilterHandler::%s(%d): Skipped %d bytes to sync on TS packet", __FUNCTION__, deviceIndexM, len);
|
debug("%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
|
||||||
@ -315,12 +315,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("cSatipSectionFilterHandler::%s(%d): exiting", __FUNCTION__, deviceIndexM);
|
debug("%s Exiting [device %d]", __PRETTY_FUNCTION__, deviceIndexM);
|
||||||
}
|
}
|
||||||
|
|
||||||
cString cSatipSectionFilterHandler::GetInformation(void)
|
cString cSatipSectionFilterHandler::GetInformation(void)
|
||||||
{
|
{
|
||||||
//debug("cSatipSectionFilterHandler::%s(%d)", __FUNCTION__, deviceIndexM);
|
//debug("%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 = "";
|
||||||
@ -339,9 +339,9 @@ cString cSatipSectionFilterHandler::GetInformation(void)
|
|||||||
|
|
||||||
bool cSatipSectionFilterHandler::Delete(unsigned int indexP)
|
bool cSatipSectionFilterHandler::Delete(unsigned int indexP)
|
||||||
{
|
{
|
||||||
//debug("cSatipSectionFilterHandler::%s(%d): index=%d", __FUNCTION__, deviceIndexM, indexP);
|
//debug("%s(%d) [device %d]", __PRETTY_FUNCTION__, indexP, deviceIndexM);
|
||||||
if ((indexP < eMaxSecFilterCount) && filtersM[indexP]) {
|
if ((indexP < eMaxSecFilterCount) && filtersM[indexP]) {
|
||||||
//debug("cSatipSectionFilterHandler::%s(%d): found %d", __FUNCTION__, deviceIndexM, indexP);
|
//debug("%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;
|
||||||
@ -352,7 +352,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("cSatipSectionFilterHandler::%s(%d): pid=%d tid=%02X mask=%02X", __FUNCTION__, deviceIndexM, pidP, tidP, maskP);
|
//debug("%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);
|
||||||
@ -360,7 +360,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("cSatipSectionFilterHandler::%s(%d): found %s", __FUNCTION__, deviceIndexM, section_filter_table[index].description);
|
//debug("%s Found %s [device %d]", __PRETTY_FUNCTION__, section_filter_table[index].description, deviceIndexM);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -378,7 +378,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("cSatipSectionFilterHandler::%s(%d): pid=%d tid=%02X mask=%02X handle=%d index=%u", __FUNCTION__, deviceIndexM, pidP, tidP, maskP, filtersM[i]->GetFd(), i);
|
//debug("%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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -393,7 +393,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("cSatipSectionFilterHandler::%s(%d): pid=%d handle=%d index=%u", __FUNCTION__, deviceIndexM, filtersM[i]->GetPid(), filtersM[i]->GetFd(), i);
|
//debug("%s(%d) pid=%d index=%u [device %d]", __PRETTY_FUNCTION__, handleP, filtersM[i]->GetPid(), i, deviceIndexM);
|
||||||
Delete(i);
|
Delete(i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -407,7 +407,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("cSatipSectionFilterHandler::%s(%d): pid=%d handle=%d index=%u", __FUNCTION__, deviceIndexM, filtersM[i]->GetPid(), filtersM[i]->GetFd(), i);
|
//debug("%s(%d) pid=%d index=%u [device %d]", __PRETTY_FUNCTION__, handleP, filtersM[i]->GetPid(), i, deviceIndexM);
|
||||||
return filtersM[i]->GetPid();
|
return filtersM[i]->GetPid();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -416,7 +416,7 @@ int cSatipSectionFilterHandler::GetPid(int handleP)
|
|||||||
|
|
||||||
void cSatipSectionFilterHandler::Write(uchar *bufferP, int lengthP)
|
void cSatipSectionFilterHandler::Write(uchar *bufferP, int lengthP)
|
||||||
{
|
{
|
||||||
//debug("cSatipSectionFilterHandler::%s(%d): length=%d", __FUNCTION__, deviceIndexM, lengthP);
|
//debug("%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
@ -332,7 +332,7 @@ cSatipPluginSetup::cSatipPluginSetup()
|
|||||||
numDisabledSourcesM(SatipConfig.GetDisabledSourcesCount()),
|
numDisabledSourcesM(SatipConfig.GetDisabledSourcesCount()),
|
||||||
numDisabledFiltersM(SatipConfig.GetDisabledFiltersCount())
|
numDisabledFiltersM(SatipConfig.GetDisabledFiltersCount())
|
||||||
{
|
{
|
||||||
debug("cSatipPluginSetup::%s()", __FUNCTION__);
|
debug("%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");
|
||||||
@ -398,7 +398,7 @@ void cSatipPluginSetup::Setup(void)
|
|||||||
|
|
||||||
eOSState cSatipPluginSetup::DeviceScan(void)
|
eOSState cSatipPluginSetup::DeviceScan(void)
|
||||||
{
|
{
|
||||||
debug("cSatipPluginSetup::%s()", __FUNCTION__);
|
debug("%s", __PRETTY_FUNCTION__);
|
||||||
cSatipDiscover::GetInstance()->TriggerScan();
|
cSatipDiscover::GetInstance()->TriggerScan();
|
||||||
|
|
||||||
return osContinue;
|
return osContinue;
|
||||||
@ -406,7 +406,7 @@ eOSState cSatipPluginSetup::DeviceScan(void)
|
|||||||
|
|
||||||
eOSState cSatipPluginSetup::DeviceInfo(void)
|
eOSState cSatipPluginSetup::DeviceInfo(void)
|
||||||
{
|
{
|
||||||
debug("cSatipPluginSetup::%s()", __FUNCTION__);
|
debug("%s", __PRETTY_FUNCTION__);
|
||||||
if (HasSubMenu() || Count() == 0)
|
if (HasSubMenu() || Count() == 0)
|
||||||
return osContinue;
|
return osContinue;
|
||||||
|
|
||||||
@ -419,7 +419,7 @@ eOSState cSatipPluginSetup::DeviceInfo(void)
|
|||||||
|
|
||||||
eOSState cSatipPluginSetup::ShowDeviceStatus(void)
|
eOSState cSatipPluginSetup::ShowDeviceStatus(void)
|
||||||
{
|
{
|
||||||
debug("cSatipPluginSetup::%s()", __FUNCTION__);
|
debug("%s", __PRETTY_FUNCTION__);
|
||||||
if (HasSubMenu() || Count() == 0)
|
if (HasSubMenu() || Count() == 0)
|
||||||
return osContinue;
|
return osContinue;
|
||||||
|
|
||||||
@ -428,7 +428,7 @@ eOSState cSatipPluginSetup::ShowDeviceStatus(void)
|
|||||||
|
|
||||||
eOSState cSatipPluginSetup::ShowInfo(void)
|
eOSState cSatipPluginSetup::ShowInfo(void)
|
||||||
{
|
{
|
||||||
debug("cSatipPluginSetup::%s()", __FUNCTION__);
|
debug("%s", __PRETTY_FUNCTION__);
|
||||||
if (HasSubMenu() || Count() == 0)
|
if (HasSubMenu() || Count() == 0)
|
||||||
return osContinue;
|
return osContinue;
|
||||||
|
|
||||||
@ -485,7 +485,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("cSatipPluginSetup::%s(%s, %s)", __FUNCTION__, nameP, *buffer);
|
debug("%s(%s, %s)", __PRETTY_FUNCTION__, nameP, *buffer);
|
||||||
SetupStore(nameP, *buffer);
|
SetupStore(nameP, *buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -501,7 +501,7 @@ void cSatipPluginSetup::StoreFilters(const char *nameP, int *valuesP)
|
|||||||
else
|
else
|
||||||
buffer = cString::sprintf("%d", valuesP[i]);
|
buffer = cString::sprintf("%d", valuesP[i]);
|
||||||
}
|
}
|
||||||
debug("cSatipPluginSetup::%s(%s, %s)", __FUNCTION__, nameP, *buffer);
|
debug("%s(%s, %s)", __PRETTY_FUNCTION__, nameP, *buffer);
|
||||||
SetupStore(nameP, *buffer);
|
SetupStore(nameP, *buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
18
socket.c
18
socket.c
@ -22,13 +22,13 @@ cSatipSocket::cSatipSocket()
|
|||||||
: socketPortM(0),
|
: socketPortM(0),
|
||||||
socketDescM(-1)
|
socketDescM(-1)
|
||||||
{
|
{
|
||||||
debug("cSatipSocket::%s()", __FUNCTION__);
|
debug("%s", __PRETTY_FUNCTION__);
|
||||||
memset(&sockAddrM, 0, sizeof(sockAddrM));
|
memset(&sockAddrM, 0, sizeof(sockAddrM));
|
||||||
}
|
}
|
||||||
|
|
||||||
cSatipSocket::~cSatipSocket()
|
cSatipSocket::~cSatipSocket()
|
||||||
{
|
{
|
||||||
debug("cSatipSocket::%s()", __FUNCTION__);
|
debug("%s", __PRETTY_FUNCTION__);
|
||||||
// Close the socket
|
// Close the socket
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
@ -60,13 +60,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("cSatipSocket::%s(%d): socketPort=%d", __FUNCTION__, portP, socketPortM);
|
debug("%s(%d) socketPort=%d", __PRETTY_FUNCTION__, portP, socketPortM);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cSatipSocket::Close(void)
|
void cSatipSocket::Close(void)
|
||||||
{
|
{
|
||||||
debug("cSatipSocket::%s(%d)", __FUNCTION__, socketPortM);
|
debug("%s sockerPort=%d", __PRETTY_FUNCTION__, socketPortM);
|
||||||
// Check if socket exists
|
// Check if socket exists
|
||||||
if (socketDescM >= 0) {
|
if (socketDescM >= 0) {
|
||||||
close(socketDescM);
|
close(socketDescM);
|
||||||
@ -78,7 +78,7 @@ void cSatipSocket::Close(void)
|
|||||||
|
|
||||||
bool cSatipSocket::Flush(void)
|
bool cSatipSocket::Flush(void)
|
||||||
{
|
{
|
||||||
debug("cSatipSocket::%s()", __FUNCTION__);
|
debug("%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);
|
||||||
@ -97,10 +97,10 @@ bool cSatipSocket::Flush(void)
|
|||||||
|
|
||||||
int cSatipSocket::Read(unsigned char *bufferAddrP, unsigned int bufferLenP)
|
int cSatipSocket::Read(unsigned char *bufferAddrP, unsigned int bufferLenP)
|
||||||
{
|
{
|
||||||
//debug("cSatipSocket::%s()", __FUNCTION__);
|
//debug("%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 cSatipUdpSocket::%s()", __FUNCTION__);
|
error("Invalid socket in %s()", __PRETTY_FUNCTION__);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
int len = 0;
|
int len = 0;
|
||||||
@ -135,10 +135,10 @@ 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("cSatipSocket::%s(%s)", __FUNCTION__, addrP);
|
debug("%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("cSatipSocket::%s(): Invalid socket", __FUNCTION__);
|
error("%s Invalid socket", __PRETTY_FUNCTION__);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
struct sockaddr_in sockAddr;
|
struct sockaddr_in sockAddr;
|
||||||
|
34
statistics.c
34
statistics.c
@ -18,17 +18,17 @@ cSatipSectionStatistics::cSatipSectionStatistics()
|
|||||||
timerM(),
|
timerM(),
|
||||||
mutexM()
|
mutexM()
|
||||||
{
|
{
|
||||||
//debug("cSatipSectionStatistics::%s()", __FUNCTION__);
|
//debug("%s", __PRETTY_FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
cSatipSectionStatistics::~cSatipSectionStatistics()
|
cSatipSectionStatistics::~cSatipSectionStatistics()
|
||||||
{
|
{
|
||||||
//debug("cSatipSectionStatistics::%s()", __FUNCTION__);
|
//debug("%s", __PRETTY_FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
cString cSatipSectionStatistics::GetSectionStatistic()
|
cString cSatipSectionStatistics::GetSectionStatistic()
|
||||||
{
|
{
|
||||||
//debug("cSatipSectionStatistics::%s()", __FUNCTION__);
|
//debug("%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();
|
||||||
@ -44,7 +44,7 @@ cString cSatipSectionStatistics::GetSectionStatistic()
|
|||||||
|
|
||||||
void cSatipSectionStatistics::AddSectionStatistic(long bytesP, long callsP)
|
void cSatipSectionStatistics::AddSectionStatistic(long bytesP, long callsP)
|
||||||
{
|
{
|
||||||
//debug("cSatipSectionStatistics::%s(%ld, %ld)", __FUNCTION__, bytesP, callsP);
|
//debug("%s(%ld, %ld)", __PRETTY_FUNCTION__, bytesP, callsP);
|
||||||
cMutexLock MutexLock(&mutexM);
|
cMutexLock MutexLock(&mutexM);
|
||||||
filteredDataM += bytesP;
|
filteredDataM += bytesP;
|
||||||
numberOfCallsM += callsP;
|
numberOfCallsM += callsP;
|
||||||
@ -57,7 +57,7 @@ cSatipPidStatistics::cSatipPidStatistics()
|
|||||||
: timerM(),
|
: timerM(),
|
||||||
mutexM()
|
mutexM()
|
||||||
{
|
{
|
||||||
debug("cSatipPidStatistics::%s()", __FUNCTION__);
|
debug("%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;
|
||||||
@ -67,12 +67,12 @@ cSatipPidStatistics::cSatipPidStatistics()
|
|||||||
|
|
||||||
cSatipPidStatistics::~cSatipPidStatistics()
|
cSatipPidStatistics::~cSatipPidStatistics()
|
||||||
{
|
{
|
||||||
debug("cSatipPidStatistics::%s()", __FUNCTION__);
|
debug("%s", __PRETTY_FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
cString cSatipPidStatistics::GetPidStatistic()
|
cString cSatipPidStatistics::GetPidStatistic()
|
||||||
{
|
{
|
||||||
//debug("cSatipPidStatistics::%s()", __FUNCTION__);
|
//debug("%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 */
|
||||||
@ -97,7 +97,7 @@ cString cSatipPidStatistics::GetPidStatistic()
|
|||||||
|
|
||||||
int cSatipPidStatistics::SortPids(const void* data1P, const void* data2P)
|
int cSatipPidStatistics::SortPids(const void* data1P, const void* data2P)
|
||||||
{
|
{
|
||||||
//debug("cSatipPidStatistics::%s()", __FUNCTION__);
|
//debug("%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)
|
||||||
@ -109,7 +109,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("cSatipPidStatistics::%s(%ld, %ld)", __FUNCTION__, pidP, payloadP);
|
//debug("%s(%ld, %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
|
||||||
@ -139,17 +139,17 @@ cSatipTunerStatistics::cSatipTunerStatistics()
|
|||||||
timerM(),
|
timerM(),
|
||||||
mutexM()
|
mutexM()
|
||||||
{
|
{
|
||||||
debug("cSatipTunerStatistics::%s()", __FUNCTION__);
|
debug("%s", __PRETTY_FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
cSatipTunerStatistics::~cSatipTunerStatistics()
|
cSatipTunerStatistics::~cSatipTunerStatistics()
|
||||||
{
|
{
|
||||||
debug("cSatipTunerStatistics::%s()", __FUNCTION__);
|
debug("%s", __PRETTY_FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
cString cSatipTunerStatistics::GetTunerStatistic()
|
cString cSatipTunerStatistics::GetTunerStatistic()
|
||||||
{
|
{
|
||||||
//debug("cSatipTunerStatistics::%s()", __FUNCTION__);
|
//debug("%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();
|
||||||
@ -165,7 +165,7 @@ cString cSatipTunerStatistics::GetTunerStatistic()
|
|||||||
|
|
||||||
void cSatipTunerStatistics::AddTunerStatistic(long bytesP)
|
void cSatipTunerStatistics::AddTunerStatistic(long bytesP)
|
||||||
{
|
{
|
||||||
//debug("cSatipTunerStatistics::%s(%ld)", __FUNCTION__, bytesP);
|
//debug("%s(%ld)", __PRETTY_FUNCTION__, bytesP);
|
||||||
cMutexLock MutexLock(&mutexM);
|
cMutexLock MutexLock(&mutexM);
|
||||||
dataBytesM += bytesP;
|
dataBytesM += bytesP;
|
||||||
}
|
}
|
||||||
@ -179,17 +179,17 @@ cSatipBufferStatistics::cSatipBufferStatistics()
|
|||||||
timerM(),
|
timerM(),
|
||||||
mutexM()
|
mutexM()
|
||||||
{
|
{
|
||||||
debug("cSatipBufferStatistics::%s()", __FUNCTION__);
|
debug("%s", __PRETTY_FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
cSatipBufferStatistics::~cSatipBufferStatistics()
|
cSatipBufferStatistics::~cSatipBufferStatistics()
|
||||||
{
|
{
|
||||||
debug("cSatipBufferStatistics::%s()", __FUNCTION__);
|
debug("%s", __PRETTY_FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
cString cSatipBufferStatistics::GetBufferStatistic()
|
cString cSatipBufferStatistics::GetBufferStatistic()
|
||||||
{
|
{
|
||||||
//debug("cSatipBufferStatistics::%s()", __FUNCTION__);
|
//debug("%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();
|
||||||
@ -213,7 +213,7 @@ cString cSatipBufferStatistics::GetBufferStatistic()
|
|||||||
|
|
||||||
void cSatipBufferStatistics::AddBufferStatistic(long bytesP, long usedP)
|
void cSatipBufferStatistics::AddBufferStatistic(long bytesP, long usedP)
|
||||||
{
|
{
|
||||||
//debug("cSatipBufferStatistics::%s(%ld, %ld)", __FUNCTION__, bytesP, usedP);
|
//debug("%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
@ -41,7 +41,7 @@ cSatipTuner::cSatipTuner(cSatipDeviceIf &deviceP, unsigned int packetLenP)
|
|||||||
delPidsM(),
|
delPidsM(),
|
||||||
pidsM()
|
pidsM()
|
||||||
{
|
{
|
||||||
debug("cSatipTuner::%s(%d) [device %d]", __FUNCTION__, packetLenP, deviceIdM);
|
debug("%s(, %d) [device %d]", __PRETTY_FUNCTION__, packetLenP, deviceIdM);
|
||||||
|
|
||||||
// Open sockets
|
// Open sockets
|
||||||
int i = 100;
|
int i = 100;
|
||||||
@ -64,7 +64,7 @@ cSatipTuner::cSatipTuner(cSatipDeviceIf &deviceP, unsigned int packetLenP)
|
|||||||
|
|
||||||
cSatipTuner::~cSatipTuner()
|
cSatipTuner::~cSatipTuner()
|
||||||
{
|
{
|
||||||
debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceIdM);
|
debug("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||||
|
|
||||||
// Stop thread
|
// Stop thread
|
||||||
sleepM.Signal();
|
sleepM.Signal();
|
||||||
@ -84,22 +84,22 @@ cSatipTuner::~cSatipTuner()
|
|||||||
|
|
||||||
void cSatipTuner::Action(void)
|
void cSatipTuner::Action(void)
|
||||||
{
|
{
|
||||||
debug("cSatipTuner::%s(): entering [device %d]", __FUNCTION__, deviceIdM);
|
debug("%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("cSatipTuner::%s(): tsIdle [device %d]", __FUNCTION__, deviceIdM);
|
//debug("%s: tsIdle [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||||
break;
|
break;
|
||||||
case tsRelease:
|
case tsRelease:
|
||||||
//debug("cSatipTuner::%s(): tsRelease [device %d]", __FUNCTION__, deviceIdM);
|
//debug("%s: tsRelease [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||||
Disconnect();
|
Disconnect();
|
||||||
RequestState(tsIdle, smInternal);
|
RequestState(tsIdle, smInternal);
|
||||||
break;
|
break;
|
||||||
case tsSet:
|
case tsSet:
|
||||||
//debug("cSatipTuner::%s(): tsSet [device %d]", __FUNCTION__, deviceIdM);
|
//debug("%s: tsSet [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||||
reConnectM.Set(eConnectTimeoutMs);
|
reConnectM.Set(eConnectTimeoutMs);
|
||||||
if (Connect()) {
|
if (Connect()) {
|
||||||
RequestState(tsTuned, smInternal);
|
RequestState(tsTuned, smInternal);
|
||||||
@ -111,7 +111,7 @@ void cSatipTuner::Action(void)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case tsTuned:
|
case tsTuned:
|
||||||
//debug("cSatipTuner::%s(): tsTuned [device %d]", __FUNCTION__, deviceIdM);
|
//debug("%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()) {
|
||||||
@ -126,7 +126,7 @@ void cSatipTuner::Action(void)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case tsLocked:
|
case tsLocked:
|
||||||
//debug("cSatipTuner::%s(): tsLocked [device %d]", __FUNCTION__, deviceIdM);
|
//debug("%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);
|
||||||
@ -150,13 +150,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("cSatipTuner::%s(): exiting [device %d]", __FUNCTION__, deviceIdM);
|
debug("%s Exiting [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cSatipTuner::Open(void)
|
bool cSatipTuner::Open(void)
|
||||||
{
|
{
|
||||||
cMutexLock MutexLock(&mutexM);
|
cMutexLock MutexLock(&mutexM);
|
||||||
debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceIdM);
|
debug("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||||
|
|
||||||
RequestState(tsSet, smExternal);
|
RequestState(tsSet, smExternal);
|
||||||
|
|
||||||
@ -167,7 +167,7 @@ bool cSatipTuner::Open(void)
|
|||||||
bool cSatipTuner::Close(void)
|
bool cSatipTuner::Close(void)
|
||||||
{
|
{
|
||||||
cMutexLock MutexLock(&mutexM);
|
cMutexLock MutexLock(&mutexM);
|
||||||
debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceIdM);
|
debug("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||||
|
|
||||||
RequestState(tsRelease, smExternal);
|
RequestState(tsRelease, smExternal);
|
||||||
|
|
||||||
@ -178,14 +178,14 @@ bool cSatipTuner::Close(void)
|
|||||||
bool cSatipTuner::Connect(void)
|
bool cSatipTuner::Connect(void)
|
||||||
{
|
{
|
||||||
cMutexLock MutexLock(&mutexM);
|
cMutexLock MutexLock(&mutexM);
|
||||||
debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceIdM);
|
debug("%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("cSatipTuner::%s(): retuning [device %d]", __FUNCTION__, deviceIdM);
|
debug("%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;
|
||||||
@ -218,7 +218,7 @@ bool cSatipTuner::Connect(void)
|
|||||||
bool cSatipTuner::Disconnect(void)
|
bool cSatipTuner::Disconnect(void)
|
||||||
{
|
{
|
||||||
cMutexLock MutexLock(&mutexM);
|
cMutexLock MutexLock(&mutexM);
|
||||||
debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceIdM);
|
debug("%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);
|
||||||
@ -244,7 +244,7 @@ bool cSatipTuner::Disconnect(void)
|
|||||||
|
|
||||||
void cSatipTuner::ProcessVideoData(u_char *bufferP, int lengthP)
|
void cSatipTuner::ProcessVideoData(u_char *bufferP, int lengthP)
|
||||||
{
|
{
|
||||||
//debug("cSatipTuner::%s(%d) [device %d]", __FUNCTION__, lengthP, deviceIdM);
|
//debug("%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);
|
||||||
@ -254,7 +254,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("cSatipTuner::%s(%d) [device %d]", __FUNCTION__, lengthP, deviceIdM);
|
//debug("%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:
|
||||||
@ -264,7 +264,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("cSatipTuner::%s(%s) [device %d]", __FUNCTION__, s, deviceIdM);
|
//debug("%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;
|
||||||
@ -305,27 +305,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("cSatipTuner::%s(%d) [device %d]", __FUNCTION__, streamIdP, deviceIdM);
|
debug("%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("cSatipTuner::%s(%s, %d) [device %d]", __FUNCTION__, sessionP, timeoutP, deviceIdM);
|
debug("%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("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceIdM);
|
//debug("%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("cSatipTuner::%s(%s, %d) [device %d]", __FUNCTION__, parameterP, indexP, deviceIdM);
|
debug("%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);
|
||||||
@ -347,7 +347,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("cSatipTuner::%s(%d, %d, %d) [device %d]", __FUNCTION__, pidP, typeP, onP, deviceIdM);
|
//debug("%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);
|
||||||
@ -367,7 +367,7 @@ bool cSatipTuner::SetPid(int pidP, int typeP, bool onP)
|
|||||||
|
|
||||||
bool cSatipTuner::UpdatePids(bool forceP)
|
bool cSatipTuner::UpdatePids(bool forceP)
|
||||||
{
|
{
|
||||||
//debug("cSatipTuner::%s(%d) tunerState=%s [device %d]", __FUNCTION__, forceP, TunerStateString(currentStateM), deviceIdM);
|
//debug("%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);
|
||||||
@ -404,7 +404,7 @@ bool cSatipTuner::UpdatePids(bool forceP)
|
|||||||
|
|
||||||
bool cSatipTuner::KeepAlive(bool forceP)
|
bool cSatipTuner::KeepAlive(bool forceP)
|
||||||
{
|
{
|
||||||
//debug("cSatipTuner::%s(%d) tunerState=%s [device %d]", __FUNCTION__, forceP, TunerStateString(currentStateM), deviceIdM);
|
//debug("%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);
|
||||||
@ -421,7 +421,7 @@ bool cSatipTuner::KeepAlive(bool forceP)
|
|||||||
|
|
||||||
bool cSatipTuner::ReadReceptionStatus(bool forceP)
|
bool cSatipTuner::ReadReceptionStatus(bool forceP)
|
||||||
{
|
{
|
||||||
//debug("cSatipTuner::%s(%d) tunerState=%s [device %d]", __FUNCTION__, forceP, TunerStateString(currentStateM), deviceIdM);
|
//debug("%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);
|
||||||
@ -438,7 +438,7 @@ bool cSatipTuner::ReadReceptionStatus(bool forceP)
|
|||||||
|
|
||||||
void cSatipTuner::UpdateCurrentState(void)
|
void cSatipTuner::UpdateCurrentState(void)
|
||||||
{
|
{
|
||||||
//debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceIdM);
|
//debug("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||||
cMutexLock MutexLock(&mutexM);
|
cMutexLock MutexLock(&mutexM);
|
||||||
eTunerState state = currentStateM;
|
eTunerState state = currentStateM;
|
||||||
|
|
||||||
@ -452,7 +452,7 @@ void cSatipTuner::UpdateCurrentState(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (currentStateM != state) {
|
if (currentStateM != state) {
|
||||||
debug("cSatipTuner::%s(): switching from %s to %s [device %d]", __FUNCTION__, TunerStateString(currentStateM), TunerStateString(state), deviceIdM);
|
debug("%s: switching from %s to %s [device %d]", __PRETTY_FUNCTION__, TunerStateString(currentStateM), TunerStateString(state), deviceIdM);
|
||||||
currentStateM = state;
|
currentStateM = state;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -460,7 +460,7 @@ void cSatipTuner::UpdateCurrentState(void)
|
|||||||
bool cSatipTuner::StateRequested(void)
|
bool cSatipTuner::StateRequested(void)
|
||||||
{
|
{
|
||||||
cMutexLock MutexLock(&mutexM);
|
cMutexLock MutexLock(&mutexM);
|
||||||
//debug("cSatipTuner::%s() current=%s internal=%d external=%d [device %d]", __FUNCTION__, TunerStateString(currentStateM), internalStateM.Size(), externalStateM.Size(), deviceIdM);
|
//debug("%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());
|
||||||
}
|
}
|
||||||
@ -468,7 +468,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("cSatipTuner::%s(%s, %s) current=%s internal=%d external=%d [device %d]", __FUNCTION__, TunerStateString(stateP), StateModeString(modeP), TunerStateString(currentStateM), internalStateM.Size(), externalStateM.Size(), deviceIdM);
|
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);
|
||||||
|
|
||||||
if (modeP == smExternal)
|
if (modeP == smExternal)
|
||||||
externalStateM.Append(stateP);
|
externalStateM.Append(stateP);
|
||||||
@ -532,30 +532,30 @@ const char *cSatipTuner::TunerStateString(eTunerState stateP)
|
|||||||
|
|
||||||
int cSatipTuner::SignalStrength(void)
|
int cSatipTuner::SignalStrength(void)
|
||||||
{
|
{
|
||||||
//debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceIdM);
|
//debug("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||||
return signalStrengthM;
|
return signalStrengthM;
|
||||||
}
|
}
|
||||||
|
|
||||||
int cSatipTuner::SignalQuality(void)
|
int cSatipTuner::SignalQuality(void)
|
||||||
{
|
{
|
||||||
//debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceIdM);
|
//debug("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||||
return signalQualityM;
|
return signalQualityM;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cSatipTuner::HasLock(void)
|
bool cSatipTuner::HasLock(void)
|
||||||
{
|
{
|
||||||
//debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceIdM);
|
//debug("%s [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||||
return (currentStateM >= tsTuned) && hasLockM;
|
return (currentStateM >= tsTuned) && hasLockM;
|
||||||
}
|
}
|
||||||
|
|
||||||
cString cSatipTuner::GetSignalStatus(void)
|
cString cSatipTuner::GetSignalStatus(void)
|
||||||
{
|
{
|
||||||
//debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceIdM);
|
//debug("%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("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceIdM);
|
//debug("%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