diff options
author | Frank Schmirler <vdr@schmirler.de> | 2010-12-02 09:39:01 +0100 |
---|---|---|
committer | Mikko Matilainen <mikkom@iki.fi> | 2011-03-24 19:20:05 +0200 |
commit | 635ccc479f3e0d62b3f52cb5407d06185e402f5b (patch) | |
tree | 8f56fa909f40656a130f41e3cab4898093fdb0e5 /client/socket.c | |
parent | db3274c046f4e2d44cb8263428073b6a43dca2fa (diff) | |
download | vdr-plugin-streamdev-635ccc479f3e0d62b3f52cb5407d06185e402f5b.tar.gz vdr-plugin-streamdev-635ccc479f3e0d62b3f52cb5407d06185e402f5b.tar.bz2 |
Snapshot 2010-09-15
Diffstat (limited to 'client/socket.c')
-rw-r--r-- | client/socket.c | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/client/socket.c b/client/socket.c index e766f7c..f2b5eea 100644 --- a/client/socket.c +++ b/client/socket.c @@ -1,5 +1,5 @@ /* - * $Id: socket.c,v 1.11.2.1 2010/06/08 05:56:15 schmirl Exp $ + * $Id: socket.c,v 1.11.2.3 2010/08/18 10:26:18 schmirl Exp $ */ #include <tools/select.h> @@ -21,6 +21,7 @@ cClientSocket ClientSocket; cClientSocket::cClientSocket(void) { memset(m_DataSockets, 0, sizeof(cTBSocket*) * si_Count); + m_Prio = false; Reset(); } @@ -143,8 +144,14 @@ bool cClientSocket::CheckConnection(void) { if(Command("CAPS FILTERS", 220)) Filters = ",FILTERS"; - isyslog("Streamdev: Connected to server %s:%d using capabilities TSPIDS%s", - RemoteIp().c_str(), RemotePort(), Filters); + const char *Prio = ""; + if(Command("CAPS PRIO", 220)) { + Prio = ",PRIO"; + m_Prio = true; + } + + isyslog("Streamdev: Connected to server %s:%d using capabilities TSPIDS%s%s", + RemoteIp().c_str(), RemotePort(), Filters, Prio); return true; } @@ -242,7 +249,7 @@ bool cClientSocket::SetChannelDevice(const cChannel *Channel) { CMD_LOCK; std::string command = (std::string)"TUNE " - + (const char*)Channel->GetChannelID().ToString(); + + (const char*)Channel->GetChannelID().ToString(); if (!Command(command, 220)) { if (errno == 0) esyslog("ERROR: Streamdev: Couldn't tune %s:%d to channel %s", @@ -252,6 +259,21 @@ bool cClientSocket::SetChannelDevice(const cChannel *Channel) { return true; } +bool cClientSocket::SetPriority(int Priority) { + if (!CheckConnection()) return false; + + CMD_LOCK; + + std::string command = (std::string)"PRIO " + (const char*)itoa(Priority); + if (!Command(command, 220)) { + if (errno == 0) + esyslog("Streamdev: Failed to update priority on %s:%d", RemoteIp().c_str(), + RemotePort()); + return false; + } + return true; +} + bool cClientSocket::SetPid(int Pid, bool On) { if (!CheckConnection()) return false; @@ -260,8 +282,8 @@ bool cClientSocket::SetPid(int Pid, bool On) { std::string command = (std::string)(On ? "ADDP " : "DELP ") + (const char*)itoa(Pid); if (!Command(command, 220)) { if (errno == 0) - esyslog("Streamdev: Pid %d not available from %s:%d", Pid, LocalIp().c_str(), - LocalPort()); + esyslog("Streamdev: Pid %d not available from %s:%d", Pid, RemoteIp().c_str(), + RemotePort()); return false; } return true; @@ -277,7 +299,7 @@ bool cClientSocket::SetFilter(ushort Pid, uchar Tid, uchar Mask, bool On) { if (!Command(command, 220)) { if (errno == 0) esyslog("Streamdev: Filter %hu, %hhu, %hhu not available from %s:%d", - Pid, Tid, Mask, LocalIp().c_str(), LocalPort()); + Pid, Tid, Mask, RemoteIp().c_str(), RemotePort()); return false; } return true; |