GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
Also add information on how to contact you by electronic and paper mail.
#
# Makefile for a Video Disk Recorder plugin
#
-# $Id: Makefile,v 1.17 2009/05/30 14:22:59 christallon Exp $
+# $Id$
# 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 = vompserver
### The version number of this plugin (taken from the main source file):
VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).c | awk '{ print $$6 }' | sed -e 's/[";]//g')
-### The C++ compiler and options:
-
-CXX ?= g++
-ifdef DEBUG
-CXXFLAGS ?= -g -Wall -Woverloaded-virtual -Wno-parentheses -Werror
-else
-CXXFLAGS ?= -O2 -Wall -Woverloaded-virtual -Wno-parentheses -Werror
-endif
-
### The directory environment:
-VDRDIR = ../../..
-LIBDIR = ../../lib
-TMPDIR = /tmp
-
-### Make sure that necessary options are included:
+# Use package data if installed...otherwise assume we're under the VDR source directory:
+PKGCFG = $(if $(VDRDIR),$(shell pkg-config --variable=$(1) $(VDRDIR)/vdr.pc),$(shell pkg-config --variable=$(1) vdr || pkg-config --variable=$(1) ../../../vdr.pc))
+LIBDIR = $(call PKGCFG,libdir)
+LOCDIR = $(call PKGCFG,locdir)
+PLGCFG = $(call PKGCFG,plgcfg)
+#
+TMPDIR ?= /tmp
-APIVERSNUM = $(shell grep 'define APIVERSNUM ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g')
-ifeq ($(shell test $(APIVERSNUM) -ge 10713; echo $$?),0) # thanks streamdev
-include $(VDRDIR)/Make.global
-endif
+### The compiler options:
-### Allow user defined options to overwrite defaults:
+export CFLAGS = $(call PKGCFG,cflags)
+export CXXFLAGS = $(call PKGCFG,cxxflags)
--include $(VDRDIR)/Make.config
+### The version number of VDR's plugin API:
-### read standlone settings if there
--include .standalone
+APIVERSION = $(call PKGCFG,apiversion)
-### The version number of VDR (taken from VDR's "config.h"):
+### Allow user defined options to overwrite defaults:
-VDRVERSION = $(shell grep 'define VDRVERSION ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g')
-APIVERSION = $(shell sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h)
+-include $(PLGCFG)
### The name of the distribution archive:
ARCHIVE = $(PLUGIN)-$(VERSION)
PACKAGE = vdr-$(ARCHIVE)
+### The name of the shared object file:
+
+SOFILE = libvdr-$(PLUGIN).so
+
### Includes and Defines (add further entries here):
+INCLUDES +=
+
+DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
+
+# VOMP-INSERT
INCLUDES += -I$(VDRDIR)/include -I$(DVBDIR)/include
-DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"' -DVOMPSERVER
+DEFINES += -D_GNU_SOURCE -DVOMPSERVER
DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
+# END-VOMP-INSERT
+
### The object files (add further files here):
-OBJS = $(PLUGIN).o dsock.o mvpserver.o udpreplier.o bootpd.o tftpd.o i18n.o vompclient.o tcp.o \
+OBJS = $(PLUGIN).o
+
+# VOMP-INSERT
+OBJS += dsock.o mvpserver.o udpreplier.o bootpd.o tftpd.o i18n.o vompclient.o tcp.o \
ringbuffer.o mvprelay.o vompclientrrproc.o \
config.o log.o thread.o tftpclient.o \
media.o responsepacket.o \
mediafile.o mediaplayer.o servermediafile.o serialize.o medialauncher.o
OBJS2 = recplayer.o mvpreceiver.o
+# END-VOMP-INSERT
+
+### The main target:
+
+# VOMP-INSERT
+all: allbase $(SOFILE) # i18n
+standalone: standalonebase vompserver-standalone
+# END-VOMP-INSERT
### Implicit rules:
%.o: %.c
$(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
-# Dependencies:
+### Dependencies:
-MAKEDEP = g++ -MM -MG
+MAKEDEP = $(CXX) -MM -MG
DEPFILE = .dependencies
$(DEPFILE): Makefile
- @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
+ @$(MAKEDEP) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
-include $(DEPFILE)
+### Internationalization (I18N):
+
+PODIR = po
+I18Npo = $(wildcard $(PODIR)/*.po)
+I18Nmo = $(addsuffix .mo, $(foreach file, $(I18Npo), $(basename $(file))))
+I18Nmsgs = $(addprefix $(DESTDIR)$(LOCDIR)/, $(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo, $(notdir $(foreach file, $(I18Npo), $(basename $(file))))))
+I18Npot = $(PODIR)/$(PLUGIN).pot
+
+%.mo: %.po
+ msgfmt -c -o $@ $<
+
+$(I18Npot): $(wildcard *.c)
+ xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --package-name=vdr-$(PLUGIN) --package-version=$(VERSION) --msgid-bugs-address='<see README>' -o $@ `ls $^`
+
+%.po: $(I18Npot)
+ msgmerge -U --no-wrap --no-location --backup=none -q -N $@ $<
+ @touch $@
+
+$(I18Nmsgs): $(DESTDIR)$(LOCDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo
+ install -D -m644 $< $@
+
+.PHONY: i18n
+i18n: $(I18Nmo) $(I18Npot)
+
+install-i18n: $(I18Nmsgs)
+
### Targets:
-all: allbase libvdr-$(PLUGIN).so
-standalone: standalonebase vompserver-standalone
+# rest of file modified for vomp
objectsstandalone: $(OBJS)
objects: $(OBJS) $(OBJS2)
standalonebase:
( if [ ! -f .standalone ] ; then ( make clean; echo "DEFINES+=-DVOMPSTANDALONE" > .standalone; echo "DEFINES+=-D_FILE_OFFSET_BITS=64" >> .standalone; make objectsstandalone ) ; else exit 0 ;fi )
-libvdr-$(PLUGIN).so: objects
- $(CXX) $(CXXFLAGS) -shared $(OBJS) $(OBJS2) -o $@
- @cp $@ $(LIBDIR)/$@.$(APIVERSION)
+$(SOFILE): objects
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) $(OBJS2) -o $@
vompserver-standalone: objectsstandalone
$(CXX) $(CXXFLAGS) $(OBJS) -lpthread -o $@
chmod u+x $@
-dist: clean
+install-lib: $(SOFILE)
+ install -D $^ $(DESTDIR)$(LIBDIR)/$^.$(APIVERSION)
+
+install: install-lib install-i18n
+
+dist: $(I18Npo) clean
@-rm -rf $(TMPDIR)/$(ARCHIVE)
@mkdir $(TMPDIR)/$(ARCHIVE)
@cp -a * $(TMPDIR)/$(ARCHIVE)
@echo Distribution package created as $(PACKAGE).tgz
clean:
- rm -f $(OBJS) $(OBJS2) $(DEPFILE) libvdr*.so* *.tgz core* *~ .standalone vompserver-standalone
-
+ @-rm -f $(PODIR)/*.mo $(PODIR)/*.pot
+ @-rm -f $(OBJS) $(OBJS2) $(DEPFILE) *.so *.tgz core* *~ .standalone vompserver-standalone
Written by: Chris Tallon <chris@loggytronic.com>
-Project's homepage: http://www.loggytronic.com/vomp
+Project's homepage: http://vomp.tv
-Latest version available at: http://www.loggytronic.com/vomp
+Latest version available at: http://vomp.tv
See the file COPYING for license information.
Description:
-Server side of VDR on MVP by Chris Tallon
+Server side of VOMP by Chris Tallon
/*
- Copyright 2004-2008 Chris Tallon
-
- This file is part of VOMP.
-
- VOMP is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- VOMP is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with VOMP; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
+ * Copyright 2004-2013 Chris Tallon
+ *
+ * This file is part of VOMP.
+ *
+ * VOMP is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * VOMP is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with VOMP; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
#ifndef VOMPSTANDALONE
#include <vdr/plugin.h>
//#include "vompclient.h"
static const char *VERSION = "0.4.0";
-static const char *DESCRIPTION = "VDR on MVP plugin by Chris Tallon";
+static const char *DESCRIPTION = "Vompserver plugin by Chris Tallon";
+static const char *MAINMENUENTRY = "Vompserver";
#ifndef VOMPSTANDALONE
-class cPluginVompserver : public cPlugin
-{
+
+class cPluginVompserver : public cPlugin {
+private:
+ MVPServer mvpserver;
+ char* configDir;
public:
cPluginVompserver(void);
virtual ~cPluginVompserver();
virtual bool ProcessArgs(int argc, char *argv[]);
virtual bool Initialize(void);
virtual bool Start(void);
- virtual bool SetupParse(const char *Name, const char *Value);
-#if VDRVERSNUM > 10300
+ virtual void Stop(void);
+ virtual void Housekeeping(void);
+ virtual void MainThreadHook(void);
virtual cString Active(void);
-#endif
-
-private:
-
- MVPServer mvpserver;
- char* configDir;
-};
+ virtual time_t WakeupTime(void);
+ virtual const char *MainMenuEntry(void) { return MAINMENUENTRY; }
+ virtual cOsdObject *MainMenuAction(void);
+ virtual cMenuSetupPage *SetupMenu(void);
+ virtual bool SetupParse(const char *Name, const char *Value);
+ virtual bool Service(const char *Id, void *Data = NULL);
+ virtual const char **SVDRPHelpPages(void);
+ virtual cString SVDRPCommand(const char *Command, const char *Option, int &ReplyCode);
+ };
cPluginVompserver::cPluginVompserver(void)
{
// Initialize any member variables here.
// DON'T DO ANYTHING ELSE THAT MAY HAVE SIDE EFFECTS, REQUIRE GLOBAL
// VDR OBJECTS TO EXIST OR PRODUCE ANY OUTPUT!
-
- configDir = NULL;
-}
-
-bool cPluginVompserver::Start(void)
-{
- // Start any background activities the plugin shall perform.
-
- if (!configDir)
- {
- const char* vdrdeveldevelret = cPlugin::ConfigDirectory("vompserver");
- if (!vdrdeveldevelret)
- {
- dsyslog("VOMP: Could not get config dir from VDR");
- return false;
- }
- configDir = new char[strlen(vdrdeveldevelret)+1];
- strcpy(configDir, vdrdeveldevelret);
- }
- int success = mvpserver.run(configDir);
- if (success) return true;
- else return false;
+ configDir = NULL;
}
cPluginVompserver::~cPluginVompserver()
{
// Clean up after yourself!
mvpserver.stop();
- if (configDir) delete[] configDir;
+ if (configDir) delete[] configDir;
}
const char *cPluginVompserver::CommandLineHelp(void)
{
// Return a string that describes all known command line options.
-
return " -c dir config path relative to VDR plugins config path\n";
}
bool cPluginVompserver::ProcessArgs(int argc, char *argv[])
{
// Implement command line argument processing here if applicable.
-
+
int c;
while ((c = getopt(argc, argv, "c:")) != -1)
{
dsyslog("VOMP: Could not get config dir from VDR");
return false;
}
-
+
configDir = new char[strlen(vdrdeveldevelret)+1];
strcpy(configDir, vdrdeveldevelret);
}
return false;
}
}
-
+
return true;
}
return true;
}
+bool cPluginVompserver::Start(void)
+{
+ // Start any background activities the plugin shall perform.
+
+ if (!configDir)
+ {
+ const char* vdrdeveldevelret = cPlugin::ConfigDirectory("vompserver");
+ if (!vdrdeveldevelret)
+ {
+ dsyslog("VOMP: Could not get config dir from VDR");
+ return false;
+ }
+ configDir = new char[strlen(vdrdeveldevelret)+1];
+ strcpy(configDir, vdrdeveldevelret);
+ }
+
+ int success = mvpserver.run(configDir);
+ if (success) return true;
+ else return false;
+}
+
+void cPluginVompserver::Stop(void)
+{
+ // Stop any background activities the plugin is performing.
+}
+
+void cPluginVompserver::Housekeeping(void)
+{
+ // Perform any cleanup or other regular tasks.
+}
+
+void cPluginVompserver::MainThreadHook(void)
+{
+ // Perform actions in the context of the main program thread.
+ // WARNING: Use with great care - see PLUGINS.html!
+}
+
+cString cPluginVompserver::Active(void)
+{
+ // Return a message string if shutdown should be postponed
+ if(VompClient::getNrClients() != 0) return tr("VOMP client(s) connected");
+ return NULL;
+}
+
+time_t cPluginVompserver::WakeupTime(void)
+{
+ // Return custom wakeup time for shutdown script
+ return 0;
+}
+
+cOsdObject *cPluginVompserver::MainMenuAction(void)
+{
+ // Perform the action when selected from the main VDR menu.
+ return NULL;
+}
+
+cMenuSetupPage *cPluginVompserver::SetupMenu(void)
+{
+ // Return a setup menu in case the plugin supports one.
+ return NULL;
+}
+
bool cPluginVompserver::SetupParse(const char *Name, const char *Value)
{
// Parse your own setup parameters and store their values.
return false;
}
-#if VDRVERSNUM > 10300
+bool cPluginVompserver::Service(const char *Id, void *Data)
+{
+ // Handle custom service requests from other plugins
+ return false;
+}
-cString cPluginVompserver::Active(void)
+const char **cPluginVompserver::SVDRPHelpPages(void)
{
- if(VompClient::getNrClients() != 0) return tr("VOMP client(s) connected");
+ // Return help text for SVDRP commands this plugin implements
return NULL;
}
-#endif
+cString cPluginVompserver::SVDRPCommand(const char *Command, const char *Option, int &ReplyCode)
+{
+ // Process SVDRP commands this plugin implements
+ return NULL;
+}
VDRPLUGINCREATOR(cPluginVompserver); // Don't touch this!
+
#else //VOMPSTANDALONE
int main(int argc, char **argv) {
char *cdir=".";
- if (argc > 1) {
- cdir=argv[1];
- }
+ if (argc > 1) {
+ cdir=argv[1];
+ }
std::cout << "Vompserver starting Version " << VERSION << " " << DESCRIPTION << std::endl;
MVPServer server;
if ( server.run(cdir) != 1) {
- std::cerr << "unable to start vompserver" << std::endl;
- return 1;
- }
+ std::cerr << "unable to start vompserver" << std::endl;
+ return 1;
+ }
while (1) sleep(1);
return 0;
}