diff options
author | Frank Schmirler <vdr@schmirler.de> | 2010-12-02 09:57:17 +0100 |
---|---|---|
committer | Mikko Matilainen <mikkom@iki.fi> | 2011-03-22 21:16:18 +0200 |
commit | 6ea5efe93960fc761dbb5e0b2d93d9b5818d5d7c (patch) | |
tree | 836d96c9a4688a01745719787a7a0e83804356f8 /client | |
parent | 0a860a1e3e45ee83563b09beb93ede0e99eb75fb (diff) | |
download | vdr-plugin-streamdev-6ea5efe93960fc761dbb5e0b2d93d9b5818d5d7c.tar.gz vdr-plugin-streamdev-6ea5efe93960fc761dbb5e0b2d93d9b5818d5d7c.tar.bz2 |
Snapshot 2010-09-15
Diffstat (limited to 'client')
-rw-r--r-- | client/Makefile | 84 | ||||
-rw-r--r-- | client/device.c | 24 | ||||
-rw-r--r-- | client/device.h | 6 | ||||
-rw-r--r-- | client/po/de_DE.po | 50 | ||||
-rw-r--r-- | client/po/fi_FI.po | 50 | ||||
-rw-r--r-- | client/po/fr_FR.po | 50 | ||||
-rw-r--r-- | client/po/it_IT.po | 52 | ||||
-rw-r--r-- | client/po/lt_LT.po | 50 | ||||
-rw-r--r-- | client/po/ru_RU.po | 50 | ||||
-rw-r--r-- | client/po/sk_SK.po | 52 | ||||
-rw-r--r-- | client/socket.c | 36 | ||||
-rw-r--r-- | client/socket.h | 5 | ||||
-rw-r--r-- | client/streamdev-client.c | 59 | ||||
-rw-r--r-- | client/streamdev-client.h | 29 |
14 files changed, 585 insertions, 12 deletions
diff --git a/client/Makefile b/client/Makefile new file mode 100644 index 0000000..ecc4787 --- /dev/null +++ b/client/Makefile @@ -0,0 +1,84 @@ +# +# Makefile for a Video Disk Recorder plugin +# +# $Id: Makefile,v 1.2 2010/07/19 13:49:25 schmirl Exp $ + +# The official name of this plugin. +# This name will be used in the '-P...' option of VDR to load the plugin. +# By default the main source file also carries this name. +# +PLUGIN = streamdev-client + +### Includes and Defines (add further entries here): + +DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"' + +### The object files (add further files here): + +COMMONOBJS = ../common.o + +CLIENTOBJS = $(PLUGIN).o \ + device.o filter.o setup.o socket.o + +### The main target: + +.PHONY: all i18n dist clean +all: libvdr-$(PLUGIN).so i18n + +### Implicit rules: + +%.o: %.c + $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $< + +### Dependencies: + +MAKEDEP = $(CXX) -MM -MG +DEPFILE = .dependencies + +$(DEPFILE): Makefile + @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(CLIENTOBJS:%.o=%.c) $(COMMONOBJS:%.o=%.c) > $@ + +-include $(DEPFILE) + +### Internationalization (I18N): + +PODIR = po +LOCALEDIR = $(VDRDIR)/locale +I18Npo = $(wildcard $(PODIR)/*.po) +I18Nmsgs = $(addprefix $(LOCALEDIR)/, $(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo, $(notdir $(foreach file, $(I18Npo), $(basename $(file)))))) +I18Npot = $(PODIR)/$(PLUGIN).pot + +%.mo: %.po + msgfmt -c -o $@ $< + +$(I18Npot): $(CLIENTOBJS:%.o=%.c) + xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --msgid-bugs-address='<http://www.vdr-developer.org/mantisbt/>' -o $@ $^ + +%.po: $(I18Npot) + msgmerge -U --no-wrap --no-location --backup=none -q $@ $< + @touch $@ + +$(I18Nmsgs): $(LOCALEDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo + @mkdir -p $(dir $@) + cp $< $@ + +i18n: $(I18Nmsgs) + +### Targets: + +libvdr-$(PLUGIN).so: $(CLIENTOBJS) $(COMMONOBJS) ../tools/sockettools.a + +%.so: + $(CXX) $(CXXFLAGS) -shared $^ -o $@ + @cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION) + +dist: clean + @-rm -rf $(TMPDIR)/$(ARCHIVE) + @mkdir $(TMPDIR)/$(ARCHIVE) + @cp -a * $(TMPDIR)/$(ARCHIVE) + @tar czf $(PACKAGE).tgz --exclude CVS -C $(TMPDIR) $(ARCHIVE) + @-rm -rf $(TMPDIR)/$(ARCHIVE) + @echo Distribution package created as $(PACKAGE).tgz + +clean: + @-rm -f $(COMMONOBJS) $(CLIENTOBJS) $(DEPFILE) $(PODIR)/*.mo $(PODIR)/*.pot *.so *.tgz core* *~ diff --git a/client/device.c b/client/device.c index d53bde1..fb80107 100644 --- a/client/device.c +++ b/client/device.c @@ -1,5 +1,5 @@ /* - * $Id: device.c,v 1.26 2010/06/08 05:55:17 schmirl Exp $ + * $Id: device.c,v 1.27 2010/08/18 10:26:55 schmirl Exp $ */ #include "client/device.h" @@ -8,6 +8,7 @@ #include "tools/select.h" +#include <vdr/config.h> #include <vdr/channels.h> #include <vdr/ringbuffer.h> #include <vdr/eit.h> @@ -32,6 +33,7 @@ cStreamdevDevice::cStreamdevDevice(void) { m_Device = this; m_Pids = 0; + m_Priority = -1; m_DvrClosed = true; } @@ -107,7 +109,7 @@ bool cStreamdevDevice::ProvidesChannel(const cChannel *Channel, int Priority, res = prio && ClientSocket.ProvidesChannel(Channel, Priority); ndr = true; } - + if (NeedsDetachReceivers) *NeedsDetachReceivers = ndr; Dprintf("prov res = %d, ndr = %d\n", res, ndr); @@ -118,6 +120,9 @@ bool cStreamdevDevice::SetChannelDevice(const cChannel *Channel, bool LiveView) { Dprintf("SetChannelDevice Channel: %s, LiveView: %s\n", Channel->Name(), LiveView ? "true" : "false"); + LOCK_THREAD; + + m_UpdatePriority = ClientSocket.SupportsPrio(); if (LiveView) return false; @@ -140,6 +145,8 @@ bool cStreamdevDevice::SetPid(cPidHandle *Handle, int Type, bool On) { Handle->used); LOCK_THREAD; + m_UpdatePriority = ClientSocket.SupportsPrio(); + if (On && !m_TSBuffer) { Dprintf("SetPid: no data connection -> OpenDvr()"); OpenDvrInt(); @@ -301,3 +308,16 @@ bool cStreamdevDevice::ReInit(void) { return StreamdevClientSetup.StartClient ? Init() : true; } +void cStreamdevDevice::UpdatePriority(void) { + if (m_Device) { + m_Device->Lock(); + if (m_Device->m_UpdatePriority && ClientSocket.DataSocket(siLive)) { + int Priority = m_Device->Priority(); + if (m_Device == cDevice::ActualDevice() && Priority < Setup.PrimaryLimit) + Priority = Setup.PrimaryLimit; + if (m_Device->m_Priority != Priority && ClientSocket.SetPriority(Priority)) + m_Device->m_Priority = Priority; + } + m_Device->Unlock(); + } +} diff --git a/client/device.h b/client/device.h index e96b05f..b2eed70 100644 --- a/client/device.h +++ b/client/device.h @@ -1,5 +1,5 @@ /* - * $Id: device.h,v 1.9 2009/06/23 10:26:54 schmirl Exp $ + * $Id: device.h,v 1.10 2010/08/18 10:26:55 schmirl Exp $ */ #ifndef VDR_STREAMDEV_DEVICE_H @@ -15,13 +15,14 @@ class cTBString; #define CMD_LOCK_OBJ(x) cMutexLock CmdLock((cMutex*)&(x)->m_Mutex) class cStreamdevDevice: public cDevice { - friend class cRemoteRecordings; private: const cChannel *m_Channel; cTSBuffer *m_TSBuffer; cStreamdevFilters *m_Filters; int m_Pids; + int m_Priority; + bool m_UpdatePriority; bool m_DvrClosed; static cStreamdevDevice *m_Device; @@ -59,6 +60,7 @@ public: #endif virtual bool IsTunedToTransponder(const cChannel *Channel); + static void UpdatePriority(void); static bool Init(void); static bool ReInit(void); diff --git a/client/po/de_DE.po b/client/po/de_DE.po new file mode 100644 index 0000000..1e481a2 --- /dev/null +++ b/client/po/de_DE.po @@ -0,0 +1,50 @@ +# VDR streamdev plugin language source file. +# Copyright (C) 2008 streamdev development team. See http://streamdev.vdr-developer.org +# This file is distributed under the same license as the VDR streamdev package. +# Frank Schmirler <vdrdev@schmirler.de>, 2008 +# +msgid "" +msgstr "" +"Project-Id-Version: streamdev 0.5.0\n" +"Report-Msgid-Bugs-To: <http://www.vdr-developer.org/mantisbt/>\n" +"POT-Creation-Date: 2010-06-14 13:05+0200\n" +"PO-Revision-Date: 2008-03-30 02:11+0200\n" +"Last-Translator: Frank Schmirler <vdrdev@schmirler.de>\n" +"Language-Team: <vdr@linuxtv.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-15\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "VTP Streaming Client" +msgstr "VTP Streaming Client" + +msgid "Suspend Server" +msgstr "Server pausieren" + +msgid "Server is suspended" +msgstr "Server ist pausiert" + +msgid "Couldn't suspend Server!" +msgstr "Konnte Server nicht pausieren!" + +msgid "Hide Mainmenu Entry" +msgstr "Hauptmenüeintrag verstecken" + +msgid "Start Client" +msgstr "Client starten" + +msgid "Remote IP" +msgstr "IP der Gegenseite" + +msgid "Remote Port" +msgstr "Port der Gegenseite" + +msgid "Filter Streaming" +msgstr "Filter-Daten streamen" + +msgid "Minimum Priority" +msgstr "Minimale Priorität" + +msgid "Maximum Priority" +msgstr "Maximale Priorität" + diff --git a/client/po/fi_FI.po b/client/po/fi_FI.po new file mode 100644 index 0000000..2091680 --- /dev/null +++ b/client/po/fi_FI.po @@ -0,0 +1,50 @@ +# VDR streamdev plugin language source file. +# Copyright (C) 2008 streamdev development team. See http://streamdev.vdr-developer.org +# This file is distributed under the same license as the VDR streamdev package. +# Rolf Ahrenberg <rahrenbe@cc.hut.fi>, 2008 +# +msgid "" +msgstr "" +"Project-Id-Version: streamdev 0.5.0\n" +"Report-Msgid-Bugs-To: <http://www.vdr-developer.org/mantisbt/>\n" +"POT-Creation-Date: 2010-06-14 13:05+0200\n" +"PO-Revision-Date: 2008-03-30 02:11+0200\n" +"Last-Translator: Rolf Ahrenberg <rahrenbe@cc.hut.fi>\n" +"Language-Team: <vdr@linuxtv.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-15\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "VTP Streaming Client" +msgstr "VTP-suoratoistoasiakas" + +msgid "Suspend Server" +msgstr "Pysäytä palvelin" + +msgid "Server is suspended" +msgstr "Palvelin on pysäytetty" + +msgid "Couldn't suspend Server!" +msgstr "Palvelinta ei onnistuttu pysäyttämään!" + +msgid "Hide Mainmenu Entry" +msgstr "Piilota valinta päävalikosta" + +msgid "Start Client" +msgstr "Käynnistä VDR-asiakas" + +msgid "Remote IP" +msgstr "Etäkoneen IP-osoite" + +msgid "Remote Port" +msgstr "Etäkoneen portti" + +msgid "Filter Streaming" +msgstr "Suodatetun tiedon suoratoisto" + +msgid "Minimum Priority" +msgstr "Pienin prioriteetti" + +msgid "Maximum Priority" +msgstr "Suurin prioriteetti" + diff --git a/client/po/fr_FR.po b/client/po/fr_FR.po new file mode 100644 index 0000000..5c3e756 --- /dev/null +++ b/client/po/fr_FR.po @@ -0,0 +1,50 @@ +# VDR streamdev plugin language source file. +# Copyright (C) 2008 streamdev development team. See http://streamdev.vdr-developer.org +# This file is distributed under the same license as the VDR streamdev package. +# Frank Schmirler <vdrdev@schmirler.de>, 2008 +# +msgid "" +msgstr "" +"Project-Id-Version: streamdev 0.5.0\n" +"Report-Msgid-Bugs-To: <http://www.vdr-developer.org/mantisbt/>\n" +"POT-Creation-Date: 2010-06-14 13:05+0200\n" +"PO-Revision-Date: 2008-03-30 02:11+0200\n" +"Last-Translator: micky979 <micky979@free.fr>\n" +"Language-Team: <vdr@linuxtv.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-15\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "VTP Streaming Client" +msgstr "Client de streaming VTP" + +msgid "Suspend Server" +msgstr "Suspendre le serveur" + +msgid "Server is suspended" +msgstr "Le serveur est suspendu" + +msgid "Couldn't suspend Server!" +msgstr "Impossible de suspendre le serveur!" + +msgid "Hide Mainmenu Entry" +msgstr "Masquer dans le menu principal" + +msgid "Start Client" +msgstr "Démarrage du client" + +msgid "Remote IP" +msgstr "Adresse IP du serveur" + +msgid "Remote Port" +msgstr "Port du serveur" + +msgid "Filter Streaming" +msgstr "Filtre streaming" + +msgid "Minimum Priority" +msgstr "" + +msgid "Maximum Priority" +msgstr "" + diff --git a/client/po/it_IT.po b/client/po/it_IT.po new file mode 100644 index 0000000..f7268e0 --- /dev/null +++ b/client/po/it_IT.po @@ -0,0 +1,52 @@ +# VDR streamdev plugin language source file. +# Copyright (C) 2008 streamdev development team. See http://streamdev.vdr-developer.org +# This file is distributed under the same license as the VDR streamdev package. +# Alberto Carraro <bertocar@tin.it>, 2001 +# Antonio Ospite <ospite@studenti.unina.it>, 2003 +# Sean Carlos <seanc@libero.it>, 2005 +# +msgid "" +msgstr "" +"Project-Id-Version: streamdev 0.5.0\n" +"Report-Msgid-Bugs-To: <http://www.vdr-developer.org/mantisbt/>\n" +"POT-Creation-Date: 2010-06-14 13:05+0200\n" +"PO-Revision-Date: 2010-06-19 03:58+0100\n" +"Last-Translator: Diego Pierotto <vdr-italian@tiscali.it>\n" +"Language-Team: <vdr@linuxtv.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-15\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "VTP Streaming Client" +msgstr "Client trasmissione VTP" + +msgid "Suspend Server" +msgstr "Sospendi Server" + +msgid "Server is suspended" +msgstr "Server sospeso" + +msgid "Couldn't suspend Server!" +msgstr "Impossibile sospendere il server!" + +msgid "Hide Mainmenu Entry" +msgstr "Nascondi voce menu principale" + +msgid "Start Client" +msgstr "Avvia Client" + +msgid "Remote IP" +msgstr "Indirizzo IP del Server" + +msgid "Remote Port" +msgstr "Porta Server Remoto" + +msgid "Filter Streaming" +msgstr "Filtra trasmissione" + +msgid "Minimum Priority" +msgstr "Priorità minima" + +msgid "Maximum Priority" +msgstr "Priorità massima" + diff --git a/client/po/lt_LT.po b/client/po/lt_LT.po new file mode 100644 index 0000000..f6a7d5c --- /dev/null +++ b/client/po/lt_LT.po @@ -0,0 +1,50 @@ +# VDR streamdev plugin language source file. +# Copyright (C) 2008 streamdev development team. See http://streamdev.vdr-developer.org +# This file is distributed under the same license as the VDR streamdev package. +# Frank Schmirler <vdrdev@schmirler.de>, 2008 +# +msgid "" +msgstr "" +"Project-Id-Version: streamdev 0.5.0\n" +"Report-Msgid-Bugs-To: <http://www.vdr-developer.org/mantisbt/>\n" +"POT-Creation-Date: 2010-06-14 13:05+0200\n" +"PO-Revision-Date: 2009-11-26 21:57+0200\n" +"Last-Translator: Valdemaras Pipiras <varas@ambernet.lt>\n" +"Language-Team: Lietuvių\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "VTP Streaming Client" +msgstr "VTP transliavimo standartas" + +msgid "Suspend Server" +msgstr "Sustabdyti serverį" + +msgid "Server is suspended" +msgstr "Serveris sustabdytas" + +msgid "Couldn't suspend Server!" +msgstr "Negali sustabdyti serverio!" + +msgid "Hide Mainmenu Entry" +msgstr "PaslÄ—pti pagrindinio meniu įraÅ¡Ä…" + +msgid "Start Client" +msgstr "Paleisti klientÄ…" + +msgid "Remote IP" +msgstr "Nuotolinis IP adresas" + +msgid "Remote Port" +msgstr "Nuotolinis portas" + +msgid "Filter Streaming" +msgstr "Filtruoti transliavimÄ…" + +msgid "Minimum Priority" +msgstr "Minimalus prioritetas" + +msgid "Maximum Priority" +msgstr "Maksimalus prioritetas" + diff --git a/client/po/ru_RU.po b/client/po/ru_RU.po new file mode 100644 index 0000000..c09d3f1 --- /dev/null +++ b/client/po/ru_RU.po @@ -0,0 +1,50 @@ +# VDR streamdev plugin language source file. +# Copyright (C) 2008 streamdev development team. See http://streamdev.vdr-developer.org +# This file is distributed under the same license as the VDR streamdev package. +# Frank Schmirler <vdrdev@schmirler.de>, 2008 +# +msgid "" +msgstr "" +"Project-Id-Version: streamdev 0.5.0\n" +"Report-Msgid-Bugs-To: <http://www.vdr-developer.org/mantisbt/>\n" +"POT-Creation-Date: 2010-06-14 13:05+0200\n" +"PO-Revision-Date: 2008-06-26 15:36+0100\n" +"Last-Translator: Oleg Roitburd <oleg@roitburd.de>\n" +"Language-Team: <vdr@linuxtv.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-5\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "VTP Streaming Client" +msgstr "VTP Streaming ÚÛØÕÝâ" + +msgid "Suspend Server" +msgstr "¾áâÐÝÞÒØâì áÕàÒÕà" + +msgid "Server is suspended" +msgstr "ÁÕàÒÕà ÞáâÐÝÞÒÛÕÝ" + +msgid "Couldn't suspend Server!" +msgstr "ÝÕ ÜÞÓã ÞáâÐÝÞÒØâì áÕàÒÕà" + +msgid "Hide Mainmenu Entry" +msgstr "ÁßàïâÐâì Ò ÓÛÐÒÝÞÜ ÜÕÝî" + +msgid "Start Client" +msgstr "ÁâÐàâ ÚÛØÕÝâÐ" + +msgid "Remote IP" +msgstr "ÃÔÐÛÕÝÝëÙ IP" + +msgid "Remote Port" +msgstr "ÃÔÐÛÕÝÝëÙ ßÞàâ" + +msgid "Filter Streaming" +msgstr "ÄØÛìâà ßÞâÞÚÐ" + +msgid "Minimum Priority" +msgstr "" + +msgid "Maximum Priority" +msgstr "" + diff --git a/client/po/sk_SK.po b/client/po/sk_SK.po new file mode 100644 index 0000000..e3dbf6b --- /dev/null +++ b/client/po/sk_SK.po @@ -0,0 +1,52 @@ +# VDR streamdev plugin language source file. +# Copyright (C) 2009 streamdev development team. See http://streamdev.vdr-developer.org +# This file is distributed under the same license as the VDR streamdev package. +# Milan Hrala <hrala.milan@gmail.com>, 2009 +# +msgid "" +msgstr "" +"Project-Id-Version: streamdev_SK\n" +"Report-Msgid-Bugs-To: <http://www.vdr-developer.org/mantisbt/>\n" +"POT-Creation-Date: 2010-06-14 13:05+0200\n" +"PO-Revision-Date: \n" +"Last-Translator: Milan Hrala <hrala.milan@gmail.com>\n" +"Language-Team: Slovak <hrala.milan@gmail.com>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=iso-8859-2\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Poedit-Language: Slovak\n" +"X-Poedit-Country: SLOVAKIA\n" + +msgid "VTP Streaming Client" +msgstr "VTP prúdový klient" + +msgid "Suspend Server" +msgstr "Server pozastavený" + +msgid "Server is suspended" +msgstr "Server je doèasne preru¹ený" + +msgid "Couldn't suspend Server!" +msgstr "Nepodarilo sa pozastavi» Server!" + +msgid "Hide Mainmenu Entry" +msgstr "Schova» polo¾ku v hlavnom menu" + +msgid "Start Client" +msgstr "Spusti» Klienta" + +msgid "Remote IP" +msgstr "Vzdialená IP" + +msgid "Remote Port" +msgstr "Vzdialený port" + +msgid "Filter Streaming" +msgstr "filtrova» prúdy" + +msgid "Minimum Priority" +msgstr "minimálna priorita" + +msgid "Maximum Priority" +msgstr "maximálna priorita" + diff --git a/client/socket.c b/client/socket.c index bd2f9ba..0e8974f 100644 --- a/client/socket.c +++ b/client/socket.c @@ -1,5 +1,5 @@ /* - * $Id: socket.c,v 1.13 2010/06/08 05:55:17 schmirl Exp $ + * $Id: socket.c,v 1.15 2010/08/18 10:26:55 schmirl Exp $ */ #include <tools/select.h> @@ -20,6 +20,7 @@ cClientSocket ClientSocket; cClientSocket::cClientSocket(void) { memset(m_DataSockets, 0, sizeof(cTBSocket*) * si_Count); + m_Prio = false; Reset(); } @@ -142,8 +143,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; } @@ -241,7 +248,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", @@ -251,6 +258,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; @@ -259,8 +281,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; @@ -276,7 +298,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; diff --git a/client/socket.h b/client/socket.h index 7ad9a80..1197678 100644 --- a/client/socket.h +++ b/client/socket.h @@ -1,5 +1,5 @@ /* - * $Id: socket.h,v 1.7 2010/06/08 05:55:17 schmirl Exp $ + * $Id: socket.h,v 1.8 2010/08/18 10:26:55 schmirl Exp $ */ #ifndef VDR_STREAMDEV_CLIENT_CONNECTION_H @@ -20,6 +20,7 @@ private: cTBSocket *m_DataSockets[si_Count]; cMutex m_Mutex; char m_Buffer[BUFSIZ + 1]; // various uses + bool m_Prio; // server supports command PRIO protected: /* Send Command, and return true if the command results in Expected. @@ -45,6 +46,8 @@ public: bool CreateDataConnection(eSocketId Id); bool CloseDataConnection(eSocketId Id); bool SetChannelDevice(const cChannel *Channel); + bool SupportsPrio() { return m_Prio; } + bool SetPriority(int Priority); bool SetPid(int Pid, bool On); bool SetFilter(ushort Pid, uchar Tid, uchar Mask, bool On); bool CloseDvr(void); diff --git a/client/streamdev-client.c b/client/streamdev-client.c new file mode 100644 index 0000000..00fa90c --- /dev/null +++ b/client/streamdev-client.c @@ -0,0 +1,59 @@ +/* + * streamdev.c: A plugin for the Video Disk Recorder + * + * See the README file for copyright information and how to reach the author. + * + * $Id: streamdev-client.c,v 1.3 2010/08/18 10:26:56 schmirl Exp $ + */ + +#include "streamdev-client.h" +#include "client/device.h" +#include "client/setup.h" + +#if !defined(APIVERSNUM) || APIVERSNUM < 10509 +#error "VDR-1.5.9 API version or greater is required!" +#endif + +const char *cPluginStreamdevClient::DESCRIPTION = trNOOP("VTP Streaming Client"); + +cPluginStreamdevClient::cPluginStreamdevClient(void) { +} + +cPluginStreamdevClient::~cPluginStreamdevClient() { +} + +const char *cPluginStreamdevClient::Description(void) { + return tr(DESCRIPTION); +} + +bool cPluginStreamdevClient::Start(void) { + I18nRegister(PLUGIN_NAME_I18N); + cStreamdevDevice::Init(); + return true; +} + +const char *cPluginStreamdevClient::MainMenuEntry(void) { + return StreamdevClientSetup.StartClient && !StreamdevClientSetup.HideMenuEntry ? tr("Suspend Server") : NULL; +} + +cOsdObject *cPluginStreamdevClient::MainMenuAction(void) { + if (ClientSocket.SuspendServer()) + Skins.Message(mtInfo, tr("Server is suspended")); + else + Skins.Message(mtError, tr("Couldn't suspend Server!")); + return NULL; +} + +cMenuSetupPage *cPluginStreamdevClient::SetupMenu(void) { + return new cStreamdevClientMenuSetupPage; +} + +bool cPluginStreamdevClient::SetupParse(const char *Name, const char *Value) { + return StreamdevClientSetup.SetupParse(Name, Value); +} + +void cPluginStreamdevClient::MainThreadHook(void) { + cStreamdevDevice::UpdatePriority(); +} + +VDRPLUGINCREATOR(cPluginStreamdevClient); // Don't touch this! diff --git a/client/streamdev-client.h b/client/streamdev-client.h new file mode 100644 index 0000000..1885ed1 --- /dev/null +++ b/client/streamdev-client.h @@ -0,0 +1,29 @@ +/* + * $Id: streamdev-client.h,v 1.3 2010/08/18 10:26:56 schmirl Exp $ + */ + +#ifndef VDR_STREAMDEVCLIENT_H +#define VDR_STREAMDEVCLIENT_H + +#include "common.h" + +#include <vdr/plugin.h> + +class cPluginStreamdevClient : public cPlugin { +private: + static const char *DESCRIPTION; + +public: + cPluginStreamdevClient(void); + virtual ~cPluginStreamdevClient(); + virtual const char *Version(void) { return VERSION; } + virtual const char *Description(void); + virtual bool Start(void); + virtual const char *MainMenuEntry(void); + virtual cOsdObject *MainMenuAction(void); + virtual cMenuSetupPage *SetupMenu(void); + virtual bool SetupParse(const char *Name, const char *Value); + virtual void MainThreadHook(void); +}; + +#endif // VDR_STREAMDEVCLIENT_H |