diff -Nru vdr-plugin-streamdev-0.5.1+git20111114/CONTRIBUTORS vdr-plugin-streamdev-0.5.1+git20111129/CONTRIBUTORS --- vdr-plugin-streamdev-0.5.1+git20111114/CONTRIBUTORS 2011-11-13 22:27:46.000000000 +0000 +++ vdr-plugin-streamdev-0.5.1+git20111129/CONTRIBUTORS 2011-11-28 15:23:57.000000000 +0000 @@ -197,3 +197,4 @@ for updating the outdated COPYING file and FSF address for restricting VTP command RENR to liemikuutio patch < 1.32 for fixing memory and filedescriptor leaks in libdvbmpeg + for code cleanup and optimization diff -Nru vdr-plugin-streamdev-0.5.1+git20111114/debian/changelog vdr-plugin-streamdev-0.5.1+git20111129/debian/changelog --- vdr-plugin-streamdev-0.5.1+git20111114/debian/changelog 2011-11-14 15:14:14.000000000 +0000 +++ vdr-plugin-streamdev-0.5.1+git20111129/debian/changelog 2011-11-29 19:05:51.000000000 +0000 @@ -1,10 +1,10 @@ -vdr-plugin-streamdev (0.5.1+git20111114-0yavdr0~natty) natty; urgency=medium +vdr-plugin-streamdev (0.5.1+git20111129-0yavdr0~natty) natty; urgency=medium * New upstream snapshot - -- Holger Schvestka Mon, 14 Nov 2011 16:12:28 +0200 + -- Holger Schvestka Tue, 29 Nov 2011 19:12:28 +0200 -vdr-plugin-streamdev (0.5.1+git20110910-1yavdr1~natty) natty; urgency=medium +vdr-plugin-streamdev (0.5.1+git20110910-1yavdr1~lucid) lucid; urgency=medium * New upstream snapshot diff -Nru vdr-plugin-streamdev-0.5.1+git20111114/HISTORY vdr-plugin-streamdev-0.5.1+git20111129/HISTORY --- vdr-plugin-streamdev-0.5.1+git20111114/HISTORY 2011-11-13 22:27:46.000000000 +0000 +++ vdr-plugin-streamdev-0.5.1+git20111129/HISTORY 2011-11-28 15:23:57.000000000 +0000 @@ -1,6 +1,10 @@ VDR Plugin 'streamdev' Revision History --------------------------------------- +- Added server menu with list of clients. Connections can be terminated + with the "red" key. The former main menu action of suspending live TV + moved to the "blue" key. +- code cleanup and optimization (thanks to Ville Skyttä) - properly shutdown IGMP timeout handler thread when the plugin is stopped. Fixes occasional segfaults on VDR exit. - fixed memory leak in libdvbmpeg read_pes (thanks to Ville Skyttä) diff -Nru vdr-plugin-streamdev-0.5.1+git20111114/libdvbmpeg/remux.c vdr-plugin-streamdev-0.5.1+git20111129/libdvbmpeg/remux.c --- vdr-plugin-streamdev-0.5.1+git20111114/libdvbmpeg/remux.c 2011-11-13 22:27:46.000000000 +0000 +++ vdr-plugin-streamdev-0.5.1+git20111129/libdvbmpeg/remux.c 2011-11-28 15:23:57.000000000 +0000 @@ -388,10 +388,9 @@ while ( acount > MAX_PLENGTH && vcount > MAX_PLENGTH && count < 10){ - int neof; count++; init_pes(&pes); - if ((neof = read_pes(fin,&pes)) <= 0) return -1; + if (read_pes(fin,&pes) <= 0) return -1; switch(pes.stream_id){ case AUDIO_STREAM_S ... AUDIO_STREAM_E: rem->apes++; @@ -702,22 +701,6 @@ rem->time_off = 0; } -uint32_t bytes2pts(int bytes, int rate) -{ - if (bytes < 0xFFFFFFFFUL/720000UL) - return (uint32_t)(bytes*720000UL/rate); - else - return (uint32_t)(bytes/rate*720000UL); -} - -long pts2bytes( uint32_t pts, int rate) -{ - if (pts < 0xEFFFFFFFUL/rate) - return (pts*rate/720000); - else - return (pts* (rate/720000)); -} - int write_audio_pes( Remux *rem, uint8_t *buf, int *alength) { int add; @@ -1088,12 +1071,6 @@ } REMUX; -void init_REMUX(REMUX *rem) -{ - rem->num_pbuf = 0; -} - - #define REPACK 2048 #define ABUF_SIZE REPACK*1024 diff -Nru vdr-plugin-streamdev-0.5.1+git20111114/libdvbmpeg/ringbuffy.c vdr-plugin-streamdev-0.5.1+git20111129/libdvbmpeg/ringbuffy.c --- vdr-plugin-streamdev-0.5.1+git20111114/libdvbmpeg/ringbuffy.c 2011-11-13 22:27:46.000000000 +0000 +++ vdr-plugin-streamdev-0.5.1+git20111129/libdvbmpeg/ringbuffy.c 2011-11-28 15:23:57.000000000 +0000 @@ -192,9 +192,8 @@ } int ring_rest(ringbuffy *rbuf){ - int diff, free, pos, rest; + int diff, free, pos; pos = rbuf->read_pos; - rest = rbuf->size - pos; diff = rbuf->write_pos - pos; free = (diff >= 0) ? diff : rbuf->size+diff; diff -Nru vdr-plugin-streamdev-0.5.1+git20111114/README vdr-plugin-streamdev-0.5.1+git20111129/README --- vdr-plugin-streamdev-0.5.1+git20111114/README 2011-11-13 22:27:46.000000000 +0000 +++ vdr-plugin-streamdev-0.5.1+git20111129/README 2011-11-28 15:23:57.000000000 +0000 @@ -175,10 +175,16 @@ commandline. To use the client core, specify -Pstreamdev-client. Both parts can run in one VDR instance, if necessary. +On the server, the main menu entry "Streamdev Connections" gives you a list +of currently connected clients. Use the "red" key to terminate a connection. +Note that depending on connection type and client, the client might re-connect +sooner or later. Depending on the server setup, the "blue" key might be enabled +as well. Please read below. + The parameter "Suspend behaviour" allows you to specify how the server should react in case the client requests a channel that would require switching the -primary device (i.e. disrupt live-tv). If set to "Offer suspend mode", you will -have a new entry in the main menu. Activating that will put the server into +primary device (i.e. disrupt live-tv). If set to "Offer suspend mode", you +enable the "blue" key in the server's main menu. It will put the server into "Suspend Mode" (a picture is displayed on TV). Then, a client may switch the primary card to wherever it likes to. While watching TV (Suspend deactivated), the client may not switch the transponder on the primary device. If you set @@ -190,10 +196,10 @@ if "Offer suspend mode" is selected). NOTE: This mainly applies to One-Card-Systems, since with multiple cards there -is no need to switch transponders on the primary interface, if the secondary -can stream a given channel (i.e. if it is not blocked by a recording). If both -cards are in use (i.e. when something is recorded, or by multiple clients), -this applies to Multiple-Card-Systems as well. +is no need to switch transponders on the primary interface, if on of the other +cards is idle (i.e. if it is not blocked by a recording). If all cards are in +use (i.e. when something is recorded, or by multiple clients), this applies to +Multiple-Card-Systems as well. 3.1 Usage HTTP server: ---------------------- diff -Nru vdr-plugin-streamdev-0.5.1+git20111114/remux/extern.c vdr-plugin-streamdev-0.5.1+git20111129/remux/extern.c --- vdr-plugin-streamdev-0.5.1+git20111114/remux/extern.c 2011-11-13 22:27:46.000000000 +0000 +++ vdr-plugin-streamdev-0.5.1+git20111129/remux/extern.c 2011-11-28 15:23:57.000000000 +0000 @@ -141,7 +141,7 @@ ADDENV("SERVER_PROTOCOL=%s", Connection->Protocol()); ADDENV("SERVER_SOFTWARE=%s", VERSION); - for (tStrStrMap::const_iterator it = Connection->Headers().begin(); it != Connection->Headers().end(); it++) { + for (tStrStrMap::const_iterator it = Connection->Headers().begin(); it != Connection->Headers().end(); ++it) { if (i >= MAXENV) { esyslog("streamdev-server: Too many headers for externremux.sh"); break; diff -Nru vdr-plugin-streamdev-0.5.1+git20111114/server/componentIGMP.c vdr-plugin-streamdev-0.5.1+git20111129/server/componentIGMP.c --- vdr-plugin-streamdev-0.5.1+git20111114/server/componentIGMP.c 2011-11-13 22:27:46.000000000 +0000 +++ vdr-plugin-streamdev-0.5.1+git20111129/server/componentIGMP.c 2011-11-28 15:23:57.000000000 +0000 @@ -6,6 +6,7 @@ #include "server/componentIGMP.h" #include "server/connectionIGMP.h" +#include "server/server.h" #include "server/setup.h" #ifndef IGMP_ALL_HOSTS @@ -37,7 +38,6 @@ class cMulticastGroup: public cListObject { public: - cConnectionIGMP *connection; in_addr_t group; in_addr_t reporter; struct timeval timeout; @@ -48,7 +48,6 @@ }; cMulticastGroup::cMulticastGroup(in_addr_t Group) : - connection(NULL), group(Group), reporter(0) { @@ -235,10 +234,7 @@ group = new cMulticastGroup(Group); m_Groups.Add(group); } - if (!group->connection) { - IGMPStartMulticast(group); - conn = group->connection; - } + conn = IGMPStartMulticast(group); IGMPStartTimer(group, Sender); if (Igmp->igmp_type == IGMP_V1_MEMBERSHIP_REPORT) IGMPStartV1HostTimer(group); @@ -430,20 +426,36 @@ IGMPSendQuery(Group->group, IGMP_LAST_MEMBER_QUERY_INTERVAL_TS); } -void cComponentIGMP::IGMPStartMulticast(cMulticastGroup* Group) +cServerConnection* cComponentIGMP::IGMPStartMulticast(cMulticastGroup* Group) { + cServerConnection *conn = NULL; in_addr_t g = ntohl(Group->group); if (g > MULTICAST_PRIV_MIN && g <= MULTICAST_PRIV_MAX) { + cThreadLock lock; cChannel *channel = Channels.GetByNumber(g - MULTICAST_PRIV_MIN); - Group->connection = (cConnectionIGMP*) NewClient(); - if (!Group->connection->SetChannel(channel, Group->group)) { - DELETENULL(Group->connection); + const cList& clients = cStreamdevServer::Clients(lock); + cServerConnection *s = clients.First(); + while (s) { + if (s->RemoteIpAddr() == Group->group) + break; + s = clients.Next(s); + } + if (!s) { + conn = NewClient(); + if (!((cConnectionIGMP *)conn)->SetChannel(channel, Group->group)) { + DELETENULL(conn); + } } } + return conn; } void cComponentIGMP::IGMPStopMulticast(cMulticastGroup* Group) { - if (Group->connection) - Group->connection->Stop(); + cThreadLock lock; + const cList& clients = cStreamdevServer::Clients(lock); + for (cServerConnection *s = clients.First(); s; s = clients.Next(s)) { + if (s->RemoteIpAddr() == Group->group) + s->Close(); + } } diff -Nru vdr-plugin-streamdev-0.5.1+git20111114/server/componentIGMP.h vdr-plugin-streamdev-0.5.1+git20111129/server/componentIGMP.h --- vdr-plugin-streamdev-0.5.1+git20111114/server/componentIGMP.h 2011-11-13 22:27:46.000000000 +0000 +++ vdr-plugin-streamdev-0.5.1+git20111129/server/componentIGMP.h 2011-11-28 15:23:57.000000000 +0000 @@ -10,7 +10,6 @@ #include #include "server/component.h" -class cConnectionIGMP; class cMulticastGroup; class cComponentIGMP: public cServerComponent, public cThread { @@ -42,7 +41,7 @@ void IGMPStartRetransmitTimer(cMulticastGroup* Group); void IGMPClearRetransmitTimer(cMulticastGroup* Group); void IGMPSendGroupQuery(cMulticastGroup* Group); - void IGMPStartMulticast(cMulticastGroup* Group); + cServerConnection* IGMPStartMulticast(cMulticastGroup* Group); void IGMPStopMulticast(cMulticastGroup* Group); virtual void Action(); diff -Nru vdr-plugin-streamdev-0.5.1+git20111114/server/connection.c vdr-plugin-streamdev-0.5.1+git20111129/server/connection.c --- vdr-plugin-streamdev-0.5.1+git20111114/server/connection.c 2011-11-13 22:27:46.000000000 +0000 +++ vdr-plugin-streamdev-0.5.1+git20111129/server/connection.c 2011-11-28 15:23:57.000000000 +0000 @@ -237,6 +237,13 @@ return true; } +bool cServerConnection::Close() +{ + if (IsOpen()) + isyslog("streamdev-server: closing %s connection to %s:%d", Protocol(), RemoteIp().c_str(), RemotePort()); + return cTBSocket::Close(); +} + #if APIVERSNUM >= 10700 static int GetClippedNumProvidedSystems(int AvailableBits, cDevice *Device) { @@ -281,7 +288,6 @@ return NULL; // no CAM is able to decrypt this channel } - bool NeedsDetachReceivers = false; cDevice *d = NULL; //cCamSlot *s = NULL; @@ -335,7 +341,6 @@ // This device has less impact than any previous one, so we take it. Impact = imp; d = device; - NeedsDetachReceivers = ndr; } } } @@ -409,3 +414,6 @@ { m_SwitchLive->Switch(); } + +cString cServerConnection::ToText() const +{ return cString::sprintf("%s\t%s:%d", Protocol(), RemoteIp().c_str(), RemotePort()); } diff -Nru vdr-plugin-streamdev-0.5.1+git20111114/server/connection.h vdr-plugin-streamdev-0.5.1+git20111129/server/connection.h --- vdr-plugin-streamdev-0.5.1+git20111114/server/connection.h 2011-11-13 22:27:46.000000000 +0000 +++ vdr-plugin-streamdev-0.5.1+git20111129/server/connection.h 2011-11-28 15:23:57.000000000 +0000 @@ -103,6 +103,9 @@ /* Will make the socket close after sending all queued output data */ void DeferClose(void) { m_DeferClose = true; } + /* Close the socket */ + virtual bool Close(void); + /* Will retrieve an unused device for transmitting data. Receivers have already been attached from the device if necessary. Use the returned cDevice in a following call to StartTransfer */ @@ -122,6 +125,9 @@ /* This connections protocol name */ virtual const char* Protocol(void) const { return m_Protocol; } + /* Representation in menu */ + virtual cString ToText(void) const; + /* std::map with additional information */ const tStrStrMap& Headers(void) const { return m_Headers; } }; diff -Nru vdr-plugin-streamdev-0.5.1+git20111114/server/connectionHTTP.c vdr-plugin-streamdev-0.5.1+git20111129/server/connectionHTTP.c --- vdr-plugin-streamdev-0.5.1+git20111114/server/connectionHTTP.c 2011-11-13 22:27:46.000000000 +0000 +++ vdr-plugin-streamdev-0.5.1+git20111129/server/connectionHTTP.c 2011-11-28 15:23:57.000000000 +0000 @@ -228,8 +228,6 @@ void cConnectionHTTP::Flushed(void) { - std::string line; - if (m_Status != hsBody) return; @@ -361,3 +359,8 @@ return false; } +cString cConnectionHTTP::ToText() const +{ + cString str = cServerConnection::ToText(); + return m_LiveStreamer ? cString::sprintf("%s\t%s", *str, *m_LiveStreamer->ToText()) : str; +} diff -Nru vdr-plugin-streamdev-0.5.1+git20111114/server/connectionHTTP.h vdr-plugin-streamdev-0.5.1+git20111129/server/connectionHTTP.h --- vdr-plugin-streamdev-0.5.1+git20111114/server/connectionHTTP.h 2011-11-13 22:27:46.000000000 +0000 +++ vdr-plugin-streamdev-0.5.1+git20111129/server/connectionHTTP.h 2011-11-28 15:23:57.000000000 +0000 @@ -47,6 +47,8 @@ virtual void Attach(void) { if (m_LiveStreamer != NULL) m_LiveStreamer->Attach(); } virtual void Detach(void) { if (m_LiveStreamer != NULL) m_LiveStreamer->Detach(); } + virtual cString ToText() const; + virtual bool CanAuthenticate(void); virtual bool Command(char *Cmd); @@ -57,7 +59,7 @@ inline bool cConnectionHTTP::Abort(void) const { - return m_LiveStreamer && m_LiveStreamer->Abort(); + return !IsOpen() || (m_LiveStreamer && m_LiveStreamer->Abort()); } #endif // VDR_STREAMDEV_SERVERS_CONNECTIONVTP_H diff -Nru vdr-plugin-streamdev-0.5.1+git20111114/server/connectionIGMP.c vdr-plugin-streamdev-0.5.1+git20111129/server/connectionIGMP.c --- vdr-plugin-streamdev-0.5.1+git20111114/server/connectionIGMP.c 2011-11-13 22:27:46.000000000 +0000 +++ vdr-plugin-streamdev-0.5.1+git20111129/server/connectionIGMP.c 2011-11-28 15:23:57.000000000 +0000 @@ -64,10 +64,15 @@ esyslog("streamdev-server IGMP: GetDevice failed"); } -void cConnectionIGMP::Stop() +bool cConnectionIGMP::Close() { - if (m_LiveStreamer) { + if (m_LiveStreamer) m_LiveStreamer->Stop(); - DELETENULL(m_LiveStreamer); - } + return cServerConnection::Close(); +} + +cString cConnectionIGMP::ToText() const +{ + cString str = cServerConnection::ToText(); + return m_LiveStreamer ? cString::sprintf("%s\t%s", *str, *m_LiveStreamer->ToText()) : str; } diff -Nru vdr-plugin-streamdev-0.5.1+git20111114/server/connectionIGMP.h vdr-plugin-streamdev-0.5.1+git20111129/server/connectionIGMP.h --- vdr-plugin-streamdev-0.5.1+git20111114/server/connectionIGMP.h 2011-11-13 22:27:46.000000000 +0000 +++ vdr-plugin-streamdev-0.5.1+git20111129/server/connectionIGMP.h 2011-11-28 15:23:57.000000000 +0000 @@ -28,20 +28,21 @@ bool SetChannel(cChannel *Channel, in_addr_t Dst); virtual void Welcome(void); - void Stop(); + virtual cString ToText() const; /* Not used here */ virtual bool Command(char *Cmd) { return false; } virtual void Attach(void) { if (m_LiveStreamer != NULL) m_LiveStreamer->Attach(); } virtual void Detach(void) { if (m_LiveStreamer != NULL) m_LiveStreamer->Detach(); } + virtual bool Close(void); virtual bool Abort(void) const; }; inline bool cConnectionIGMP::Abort(void) const { - return !m_LiveStreamer || m_LiveStreamer->Abort(); + return !IsOpen() || !m_LiveStreamer || m_LiveStreamer->Abort(); } #endif // VDR_STREAMDEV_SERVERS_CONNECTIONIGMP_H diff -Nru vdr-plugin-streamdev-0.5.1+git20111114/server/connectionVTP.c vdr-plugin-streamdev-0.5.1+git20111129/server/connectionVTP.c --- vdr-plugin-streamdev-0.5.1+git20111114/server/connectionVTP.c 2011-11-13 22:27:46.000000000 +0000 +++ vdr-plugin-streamdev-0.5.1+git20111129/server/connectionVTP.c 2011-11-28 15:23:57.000000000 +0000 @@ -774,7 +774,7 @@ bool cConnectionVTP::Abort(void) const { - return (m_LiveStreamer && m_LiveStreamer->Abort()) || + return !IsOpen() || (m_LiveStreamer && m_LiveStreamer->Abort()) || (m_FilterStreamer && m_FilterStreamer->Abort()); } @@ -1811,3 +1811,14 @@ Code < 0 ? -Code : Code, Code < 0 ? '-' : ' ', *str); } + +cString cConnectionVTP::ToText() const +{ + cString str = cServerConnection::ToText(); + if (m_LiveStreamer) + return cString::sprintf("%s\t%s", *str, *m_LiveStreamer->ToText()); + else if (m_RecPlayer) + return cString::sprintf("%s\t%s", *str, m_RecPlayer->getCurrentRecording()->Name()); + else + return str; +} diff -Nru vdr-plugin-streamdev-0.5.1+git20111114/server/connectionVTP.h vdr-plugin-streamdev-0.5.1+git20111129/server/connectionVTP.h --- vdr-plugin-streamdev-0.5.1+git20111114/server/connectionVTP.h 2011-11-13 22:27:46.000000000 +0000 +++ vdr-plugin-streamdev-0.5.1+git20111129/server/connectionVTP.h 2011-11-28 15:23:57.000000000 +0000 @@ -53,6 +53,8 @@ virtual void Welcome(void); virtual void Reject(void); + virtual cString ToText() const; + virtual bool Abort(void) const; virtual void Detach(void); virtual void Attach(void); diff -Nru vdr-plugin-streamdev-0.5.1+git20111114/server/livestreamer.c vdr-plugin-streamdev-0.5.1+git20111129/server/livestreamer.c --- vdr-plugin-streamdev-0.5.1+git20111114/server/livestreamer.c 2011-11-13 22:27:46.000000000 +0000 +++ vdr-plugin-streamdev-0.5.1+git20111129/server/livestreamer.c 2011-11-28 15:23:57.000000000 +0000 @@ -460,6 +460,14 @@ } } +cString cStreamdevLiveStreamer::ToText() const +{ + if (m_Device && m_Channel) { + return cString::sprintf("DVB%-2d %3d %s", m_Device->DeviceNumber() + 1, m_Channel->Number(), m_Channel->Name()); + } + return cString(""); +} + void cStreamdevLiveStreamer::StartReceiver(void) { if (m_NumPids > 0) { diff -Nru vdr-plugin-streamdev-0.5.1+git20111114/server/livestreamer.h vdr-plugin-streamdev-0.5.1+git20111129/server/livestreamer.h --- vdr-plugin-streamdev-0.5.1+git20111114/server/livestreamer.h 2011-11-13 22:27:46.000000000 +0000 +++ vdr-plugin-streamdev-0.5.1+git20111129/server/livestreamer.h 2011-11-28 15:23:57.000000000 +0000 @@ -40,6 +40,7 @@ bool SetChannel(const cChannel *Channel, eStreamType StreamType, const int* Apid = NULL, const int* Dpid = NULL); void SetPriority(int Priority); void GetSignal(int *DevNum, int *Strength, int *Quality) const; + cString ToText() const; virtual int Put(const uchar *Data, int Count); virtual uchar *Get(int &Count); diff -Nru vdr-plugin-streamdev-0.5.1+git20111114/server/Makefile vdr-plugin-streamdev-0.5.1+git20111129/server/Makefile --- vdr-plugin-streamdev-0.5.1+git20111114/server/Makefile 2011-11-13 22:27:46.000000000 +0000 +++ vdr-plugin-streamdev-0.5.1+git20111129/server/Makefile 2011-11-28 15:23:57.000000000 +0000 @@ -23,7 +23,7 @@ componentHTTP.o connectionHTTP.o menuHTTP.o \ componentIGMP.o connectionIGMP.o \ streamer.o livestreamer.o livefilter.o recplayer.o \ - suspend.o setup.o + menu.o suspend.o setup.o ### The main target: diff -Nru vdr-plugin-streamdev-0.5.1+git20111114/server/menu.c vdr-plugin-streamdev-0.5.1+git20111129/server/menu.c --- vdr-plugin-streamdev-0.5.1+git20111114/server/menu.c 1970-01-01 00:00:00.000000000 +0000 +++ vdr-plugin-streamdev-0.5.1+git20111129/server/menu.c 2011-11-28 15:23:57.000000000 +0000 @@ -0,0 +1,68 @@ +/* + * $Id: menu.c,v 1.10 2010/07/19 13:49:31 schmirl Exp $ + */ + +#include +#include +#include + +#include "server/menu.h" +#include "server/setup.h" +#include "server/server.h" +#include "server/suspend.h" + +cStreamdevServerMenu::cStreamdevServerMenu(): cOsdMenu(tr("Streamdev Connections"), 4, 20) { + cThreadLock lock; + const cList& clients = cStreamdevServer::Clients(lock); + for (cServerConnection *s = clients.First(); s; s = clients.Next(s)) + Add(new cOsdItem(s->ToText())); + SetHelpKeys(); + Display(); +} + +cStreamdevServerMenu::~cStreamdevServerMenu() { +} + +void cStreamdevServerMenu::SetHelpKeys() { + SetHelp(Count() ? tr("Disconnect") : NULL, NULL, NULL, StreamdevServerSetup.SuspendMode == smOffer ? tr("Suspend") : NULL); +} + +eOSState cStreamdevServerMenu::Disconnect() { + cOsdItem *item = Get(Current()); + if (item) { + cThreadLock lock; + const cList& clients = cStreamdevServer::Clients(lock); + const char *text = item->Text(); + for (cServerConnection *s = clients.First(); s; s = clients.Next(s)) { + if (!strcmp(text, s->ToText())) { + s->Close(); + Del(Current()); + SetHelpKeys(); + Display(); + break; + } + } + } + return osContinue; +} + +eOSState cStreamdevServerMenu::Suspend() { + if (StreamdevServerSetup.SuspendMode == smOffer && !cSuspendCtl::IsActive()) { + cControl::Launch(new cSuspendCtl); + return osBack; + } + return osContinue; +} + +eOSState cStreamdevServerMenu::ProcessKey(eKeys Key) { + eOSState state = cOsdMenu::ProcessKey(Key); + if (state == osUnknown) { + switch (Key) { + case kRed: return Disconnect(); + case kBlue: return Suspend(); + case kOk: return osBack; + default: break; + } + } + return state; +} diff -Nru vdr-plugin-streamdev-0.5.1+git20111114/server/menu.h vdr-plugin-streamdev-0.5.1+git20111129/server/menu.h --- vdr-plugin-streamdev-0.5.1+git20111114/server/menu.h 1970-01-01 00:00:00.000000000 +0000 +++ vdr-plugin-streamdev-0.5.1+git20111129/server/menu.h 2011-11-28 15:23:57.000000000 +0000 @@ -0,0 +1,24 @@ +/* + * $Id: menu.h,v 1.4 2010/07/19 13:49:31 schmirl Exp $ + */ + +#ifndef VDR_STREAMDEV_MENU_H +#define VDR_STREAMDEV_MENU_H + +#include +#include "connection.h" + +class cStreamdevServerMenu: public cOsdMenu { +private: + void SetHelpKeys(); + eOSState Disconnect(); + eOSState Suspend(); +protected: + virtual eOSState ProcessKey(eKeys Key); + +public: + cStreamdevServerMenu(); + virtual ~cStreamdevServerMenu(); +}; + +#endif // VDR_STREAMDEV_MENU_H diff -Nru vdr-plugin-streamdev-0.5.1+git20111114/server/po/de_DE.po vdr-plugin-streamdev-0.5.1+git20111129/server/po/de_DE.po --- vdr-plugin-streamdev-0.5.1+git20111114/server/po/de_DE.po 2011-11-13 22:27:46.000000000 +0000 +++ vdr-plugin-streamdev-0.5.1+git20111129/server/po/de_DE.po 2011-11-28 15:23:57.000000000 +0000 @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: streamdev 0.5.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-06-14 13:06+0200\n" +"POT-Creation-Date: 2011-11-22 01:05+0100\n" "PO-Revision-Date: 2008-03-30 02:11+0200\n" "Last-Translator: Frank Schmirler \n" "Language-Team: \n" @@ -21,8 +21,14 @@ msgid "Streaming active" msgstr "Streamen im Gange" -msgid "Suspend Live TV" -msgstr "Live-TV pausieren" +msgid "Streamdev Connections" +msgstr "Streamdev Verbindungen" + +msgid "Disconnect" +msgstr "Trennen" + +msgid "Suspend" +msgstr "Pausieren" msgid "Offer suspend mode" msgstr "Pausieren anbieten" @@ -80,4 +86,3 @@ msgid "Multicast Streamtype" msgstr "Multicast Streamtyp" - diff -Nru vdr-plugin-streamdev-0.5.1+git20111114/server/po/es_ES.po vdr-plugin-streamdev-0.5.1+git20111129/server/po/es_ES.po --- vdr-plugin-streamdev-0.5.1+git20111114/server/po/es_ES.po 2011-11-13 22:27:46.000000000 +0000 +++ vdr-plugin-streamdev-0.5.1+git20111129/server/po/es_ES.po 2011-11-28 15:23:57.000000000 +0000 @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: streamdev 0.5.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-06-14 13:06+0200\n" +"POT-Creation-Date: 2011-11-22 01:05+0100\n" "PO-Revision-Date: 2010-06-19 03:58+0100\n" "Last-Translator: Javier Bradineras \n" "Language-Team: \n" @@ -21,8 +21,14 @@ msgid "Streaming active" msgstr "Trasmisión activa" -msgid "Suspend Live TV" -msgstr "Suspender TV en vivo" +msgid "Streamdev Connections" +msgstr "" + +msgid "Disconnect" +msgstr "" + +msgid "Suspend" +msgstr "Suspender" msgid "Offer suspend mode" msgstr "Ofrecer modo de suspensión" @@ -80,5 +86,3 @@ msgid "Multicast Streamtype" msgstr "Tipo de flujo Multicast" - - diff -Nru vdr-plugin-streamdev-0.5.1+git20111114/server/po/fi_FI.po vdr-plugin-streamdev-0.5.1+git20111129/server/po/fi_FI.po --- vdr-plugin-streamdev-0.5.1+git20111114/server/po/fi_FI.po 2011-11-13 22:27:46.000000000 +0000 +++ vdr-plugin-streamdev-0.5.1+git20111129/server/po/fi_FI.po 2011-11-28 15:23:57.000000000 +0000 @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: streamdev 0.5.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-06-14 13:06+0200\n" +"POT-Creation-Date: 2011-11-22 01:05+0100\n" "PO-Revision-Date: 2008-03-30 02:11+0200\n" "Last-Translator: Rolf Ahrenberg \n" "Language-Team: \n" @@ -21,8 +21,14 @@ msgid "Streaming active" msgstr "Suoratoistopalvelin aktiivinen" -msgid "Suspend Live TV" -msgstr "Pysäytä suora TV-lähetys" +msgid "Streamdev Connections" +msgstr "" + +msgid "Disconnect" +msgstr "" + +msgid "Suspend" +msgstr "Pysäytä" msgid "Offer suspend mode" msgstr "tyrkytä" @@ -80,4 +86,3 @@ msgid "Multicast Streamtype" msgstr "Multicast-lähetysmuoto" - diff -Nru vdr-plugin-streamdev-0.5.1+git20111114/server/po/fr_FR.po vdr-plugin-streamdev-0.5.1+git20111129/server/po/fr_FR.po --- vdr-plugin-streamdev-0.5.1+git20111114/server/po/fr_FR.po 2011-11-13 22:27:46.000000000 +0000 +++ vdr-plugin-streamdev-0.5.1+git20111129/server/po/fr_FR.po 2011-11-28 15:23:57.000000000 +0000 @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: streamdev 0.5.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-06-14 13:06+0200\n" +"POT-Creation-Date: 2011-11-22 01:05+0100\n" "PO-Revision-Date: 2008-03-30 02:11+0200\n" "Last-Translator: micky979 \n" "Language-Team: \n" @@ -21,8 +21,14 @@ msgid "Streaming active" msgstr "Streaming actif" -msgid "Suspend Live TV" -msgstr "Suspendre Live TV" +msgid "Streamdev Connections" +msgstr "" + +msgid "Disconnect" +msgstr "" + +msgid "Suspend" +msgstr "Suspendre" msgid "Offer suspend mode" msgstr "Offrir le mode suspendre" @@ -80,4 +86,3 @@ msgid "Multicast Streamtype" msgstr "" - diff -Nru vdr-plugin-streamdev-0.5.1+git20111114/server/po/it_IT.po vdr-plugin-streamdev-0.5.1+git20111129/server/po/it_IT.po --- vdr-plugin-streamdev-0.5.1+git20111114/server/po/it_IT.po 2011-11-13 22:27:46.000000000 +0000 +++ vdr-plugin-streamdev-0.5.1+git20111129/server/po/it_IT.po 2011-11-28 15:23:57.000000000 +0000 @@ -9,7 +9,7 @@ msgstr "" "Project-Id-Version: streamdev 0.5.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-06-14 13:06+0200\n" +"POT-Creation-Date: 2011-11-22 01:05+0100\n" "PO-Revision-Date: 2010-06-19 03:58+0100\n" "Last-Translator: Diego Pierotto \n" "Language-Team: \n" @@ -23,8 +23,14 @@ msgid "Streaming active" msgstr "Trasmissione attiva" -msgid "Suspend Live TV" -msgstr "Sospendi TV dal vivo" +msgid "Streamdev Connections" +msgstr "" + +msgid "Disconnect" +msgstr "" + +msgid "Suspend" +msgstr "Sospendi" msgid "Offer suspend mode" msgstr "Offri mod. sospensione" @@ -82,4 +88,3 @@ msgid "Multicast Streamtype" msgstr "Tipo flusso Multicast" - diff -Nru vdr-plugin-streamdev-0.5.1+git20111114/server/po/lt_LT.po vdr-plugin-streamdev-0.5.1+git20111129/server/po/lt_LT.po --- vdr-plugin-streamdev-0.5.1+git20111114/server/po/lt_LT.po 2011-11-13 22:27:46.000000000 +0000 +++ vdr-plugin-streamdev-0.5.1+git20111129/server/po/lt_LT.po 2011-11-28 15:23:57.000000000 +0000 @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: streamdev 0.5.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-06-14 13:06+0200\n" +"POT-Creation-Date: 2011-11-22 01:05+0100\n" "PO-Revision-Date: 2009-11-26 21:57+0200\n" "Last-Translator: Valdemaras Pipiras \n" "Language-Team: Lietuvių\n" @@ -21,8 +21,14 @@ msgid "Streaming active" msgstr "Transliavimas vyksta" -msgid "Suspend Live TV" -msgstr "Pristabdyti Live TV" +msgid "Streamdev Connections" +msgstr "" + +msgid "Disconnect" +msgstr "" + +msgid "Suspend" +msgstr "Pristabdyti" msgid "Offer suspend mode" msgstr "Klausti dÄ—l sustabdymo" @@ -80,4 +86,3 @@ msgid "Multicast Streamtype" msgstr "Multicast transliavimo tipas" - diff -Nru vdr-plugin-streamdev-0.5.1+git20111114/server/po/ru_RU.po vdr-plugin-streamdev-0.5.1+git20111129/server/po/ru_RU.po --- vdr-plugin-streamdev-0.5.1+git20111114/server/po/ru_RU.po 2011-11-13 22:27:46.000000000 +0000 +++ vdr-plugin-streamdev-0.5.1+git20111129/server/po/ru_RU.po 2011-11-28 15:23:57.000000000 +0000 @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: streamdev 0.5.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-06-14 13:06+0200\n" +"POT-Creation-Date: 2011-11-22 01:05+0100\n" "PO-Revision-Date: 2008-06-26 15:36+0100\n" "Last-Translator: Oleg Roitburd \n" "Language-Team: \n" @@ -21,8 +21,14 @@ msgid "Streaming active" msgstr "ÁâàØÜØÝÓ ÐÚâØÒÕÝ" -msgid "Suspend Live TV" -msgstr "¾áâÐÝÞÒÚÐ Live TV" +msgid "Streamdev Connections" +msgstr "" + +msgid "Disconnect" +msgstr "" + +msgid "Suspend" +msgstr "¾áâÐÝÞÒÚÐ" msgid "Offer suspend mode" msgstr "¿àÕÔÛÐÓÐâì ÞáâÐÝÞÒÚã" @@ -80,4 +86,3 @@ msgid "Multicast Streamtype" msgstr "" - diff -Nru vdr-plugin-streamdev-0.5.1+git20111114/server/po/sk_SK.po vdr-plugin-streamdev-0.5.1+git20111129/server/po/sk_SK.po --- vdr-plugin-streamdev-0.5.1+git20111114/server/po/sk_SK.po 2011-11-13 22:27:46.000000000 +0000 +++ vdr-plugin-streamdev-0.5.1+git20111129/server/po/sk_SK.po 2011-11-28 15:23:57.000000000 +0000 @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: streamdev_SK\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-06-14 13:06+0200\n" +"POT-Creation-Date: 2011-11-22 01:05+0100\n" "PO-Revision-Date: \n" "Last-Translator: Milan Hrala \n" "Language-Team: Slovak \n" @@ -23,8 +23,14 @@ msgid "Streaming active" msgstr "streamovanie aktivne" -msgid "Suspend Live TV" -msgstr "Pozastavenie ¾ivého vysielania" +msgid "Streamdev Connections" +msgstr "" + +msgid "Disconnect" +msgstr "" + +msgid "Suspend" +msgstr "Pozastavenie" msgid "Offer suspend mode" msgstr "Výber re¾ímu pozastavenia" @@ -82,4 +88,3 @@ msgid "Multicast Streamtype" msgstr "Multicast typ streamu" - diff -Nru vdr-plugin-streamdev-0.5.1+git20111114/server/server.c vdr-plugin-streamdev-0.5.1+git20111129/server/server.c --- vdr-plugin-streamdev-0.5.1+git20111114/server/server.c 2011-11-13 22:27:46.000000000 +0000 +++ vdr-plugin-streamdev-0.5.1+git20111129/server/server.c 2011-11-28 15:23:57.000000000 +0000 @@ -152,9 +152,8 @@ cServerConnection *next = m_Clients.Next(s); if (!result) { - isyslog("streamdev: closing streamdev connection to %s:%d", - s->RemoteIp().c_str(), s->RemotePort()); - s->Close(); + if (s->IsOpen()) + s->Close(); Lock(); m_Clients.Del(s); Unlock(); @@ -178,9 +177,8 @@ } } -void cStreamdevServer::MainThreadHook(void) +const cList& cStreamdevServer::Clients(cThreadLock& Lock) { - cThreadLock lock(m_Instance); - for (cServerConnection *s = m_Clients.First(); s; s = m_Clients.Next(s)) - s->MainThreadHook(); + Lock.Lock(m_Instance); + return m_Clients; } diff -Nru vdr-plugin-streamdev-0.5.1+git20111114/server/server.h vdr-plugin-streamdev-0.5.1+git20111129/server/server.h --- vdr-plugin-streamdev-0.5.1+git20111114/server/server.h 2011-11-13 22:27:46.000000000 +0000 +++ vdr-plugin-streamdev-0.5.1+git20111129/server/server.h 2011-11-28 15:23:57.000000000 +0000 @@ -36,7 +36,8 @@ static void Initialize(void); static void Destruct(void); static bool Active(void); - static void MainThreadHook(void); + + static const cList& Clients(cThreadLock& Lock); }; inline bool cStreamdevServer::Active(void) diff -Nru vdr-plugin-streamdev-0.5.1+git20111114/server/streamdev-server.c vdr-plugin-streamdev-0.5.1+git20111129/server/streamdev-server.c --- vdr-plugin-streamdev-0.5.1+git20111114/server/streamdev-server.c 2011-11-13 22:27:46.000000000 +0000 +++ vdr-plugin-streamdev-0.5.1+git20111129/server/streamdev-server.c 2011-11-28 15:23:57.000000000 +0000 @@ -9,9 +9,9 @@ #include #include #include "streamdev-server.h" +#include "server/menu.h" #include "server/setup.h" #include "server/server.h" -#include "server/suspend.h" #if !defined(APIVERSNUM) || APIVERSNUM < 10516 #error "VDR-1.5.16 API version or greater is required!" @@ -119,20 +119,20 @@ const char *cPluginStreamdevServer::MainMenuEntry(void) { - if (StreamdevServerSetup.SuspendMode == smOffer && !cSuspendCtl::IsActive()) - return tr("Suspend Live TV"); - return NULL; + return tr("Streamdev Connections"); } cOsdObject *cPluginStreamdevServer::MainMenuAction(void) { - cControl::Launch(new cSuspendCtl); - return NULL; + return new cStreamdevServerMenu(); } void cPluginStreamdevServer::MainThreadHook(void) { - cStreamdevServer::MainThreadHook(); + cThreadLock lock; + const cList& clients = cStreamdevServer::Clients(lock); + for (cServerConnection *s = clients.First(); s; s = clients.Next(s)) + s->MainThreadHook(); } cMenuSetupPage *cPluginStreamdevServer::SetupMenu(void)