Removed support for older vdr versions.

This commit is contained in:
Rolf Ahrenberg 2008-02-19 22:29:02 +00:00
parent c8fe6b1389
commit 71952ae0dc
10 changed files with 20 additions and 283 deletions

View File

@ -49,3 +49,7 @@ VDR Plugin 'iptv' Revision History
- Modified channels.conf format to enable/disable channel
specific pid and sid scanning functionality.
- Removed the general sid scanning setup option.
2008-03-xx: Version 0.2.0
- Updated for vdr-1.6.0.

View File

@ -1,7 +1,7 @@
#
# Makefile for a Video Disk Recorder plugin
#
# $Id: Makefile,v 1.26 2008/01/30 22:41:58 rahrenbe Exp $
# $Id: Makefile,v 1.27 2008/02/19 22:29:02 rahrenbe Exp $
# Debugging on/off
#IPTV_DEBUG = 1
@ -39,11 +39,6 @@ TMPDIR = /tmp
### The version number of VDR's plugin API (taken from VDR's "config.h"):
APIVERSION = $(shell sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h)
APIVERSNUM = $(shell sed -ne '/define APIVERSNUM/s/^.*APIVERSNUM[ \t]*\([0-9]*\).*$$/\1/p' $(VDRDIR)/config.h)
### Test whether VDR has locale support
#VDRLOCALE = $(shell grep '^LOCALEDIR' $(VDRDIR)/Makefile)
VDRLOCALE = $(shell if [ $(APIVERSNUM) -ge 10507 ]; then echo "locale"; fi)
### The name of the distribution archive:
@ -60,11 +55,14 @@ ifdef IPTV_DEBUG
DEFINES += -DDEBUG
endif
.PHONY: all all-redirect
all-redirect: all
### The object files (add further files here):
OBJS = $(PLUGIN).o config.o setup.o device.o streamer.o protocoludp.o \
protocolhttp.o protocolfile.o protocolext.o sectionfilter.o \
sidscanner.o pidscanner.o statistics.o common.o socket.o i18n.o
sidscanner.o pidscanner.o statistics.o common.o socket.o
### The main target:
@ -80,7 +78,7 @@ all: libvdr-$(PLUGIN).so i18n
MAKEDEP = $(CXX) -MM -MG
DEPFILE = .dependencies
$(DEPFILE): Makefile
@$(MAKEDEP) $(DEFINES) $(INCLUDES) $(subst i18n.c,,$(OBJS:%.o=%.c)) > $@
@$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
-include $(DEPFILE)
@ -91,20 +89,11 @@ 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
ifeq ($(strip $(APIVERSION)),1.5.7)
I18Nvdrmo = $(PLUGIN).mo
else
I18Nvdrmo = vdr-$(PLUGIN).mo
endif
### Do gettext based i18n stuff
ifneq ($(strip $(VDRLOCALE)),)
%.mo: %.po
msgfmt -c -o $@ $<
$(I18Npot): $(subst i18n.c,,$(wildcard *.c))
$(I18Npot): $(wildcard *.c)
xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --msgid-bugs-address='Rolf Ahrenberg' -o $@ $^
%.po: $(I18Npot)
@ -116,23 +105,7 @@ $(I18Nmsgs): $(LOCALEDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo
cp $< $@
.PHONY: i18n
i18n: $(I18Nmsgs)
i18n.c: i18n-template.c
@cp i18n-template.c i18n.c
### Do i18n.c based i18n stuff
else
i18n:
@### nothing to do
#i18n compatibility generator:
i18n.c: i18n-template.c po2i18n.pl $(I18Npo)
./po2i18n.pl < i18n-template.c > i18n.c
endif
i18n: $(I18Nmsgs) $(I18Npot)
### Targets:
@ -152,4 +125,4 @@ dist: clean
@echo Distribution package created as $(PACKAGE).tgz
clean:
@-rm -f $(OBJS) $(DEPFILE) i18n.c *.so *.tgz core* *~ $(PODIR)/*.mo $(PODIR)/*.pot
@-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~ $(PODIR)/*.mo $(PODIR)/*.pot

2
README
View File

@ -175,5 +175,3 @@ Acknowledgements:
- The IPTV section filtering code is derived from Linux kernel.
- The pid scanning code is derived from Udo Richter's streamplayer plugin.
- Udo Richter's po2i18n package is used to support VDR's old i18n system.

View File

@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: device.c,v 1.84 2008/02/17 19:18:47 rahrenbe Exp $
* $Id: device.c,v 1.85 2008/02/19 22:29:02 rahrenbe Exp $
*/
#include "config.h"
@ -58,10 +58,8 @@ cIptvDevice::cIptvDevice(unsigned int Index)
cIptvDevice::~cIptvDevice()
{
debug("cIptvDevice::~cIptvDevice(%d)\n", deviceIndex);
#if defined(APIVERSNUM) && APIVERSNUM >= 10515
// Stop section handler of iptv device
StopSectionHandler();
#endif
DELETE_POINTER(pIptvStreamer);
DELETE_POINTER(pUdpProtocol);
DELETE_POINTER(pHttpProtocol);

View File

@ -1,18 +0,0 @@
/*
* i18n.c: IPTV plugin for the Video Disk Recorder
*
* See the README file for copyright information and how to reach the author.
*
* $Id: i18n-template.c,v 1.1 2007/10/28 16:22:44 rahrenbe Exp $
*/
#include "common.h"
#include "i18n.h"
#if defined(APIVERSNUM) && APIVERSNUM < 10507
const tI18nPhrase IptvPhrases[] = {
// START I18N
// END I18N
{ NULL }
};
#endif

18
i18n.h
View File

@ -1,18 +0,0 @@
/*
* i18n.h: IPTV plugin for the Video Disk Recorder
*
* See the README file for copyright information and how to reach the author.
*
* $Id: i18n.h,v 1.1 2007/10/28 16:22:44 rahrenbe Exp $
*/
#ifndef __IPTV_I18N_H
#define __IPTV_I18N_H
#include <vdr/i18n.h>
#if defined(APIVERSNUM) && APIVERSNUM < 10507
extern const tI18nPhrase IptvPhrases[];
#endif
#endif // __IPTV_I18N_H

12
iptv.c
View File

@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: iptv.c,v 1.36 2008/02/01 21:54:24 rahrenbe Exp $
* $Id: iptv.c,v 1.37 2008/02/19 22:29:02 rahrenbe Exp $
*/
#include <getopt.h>
@ -12,17 +12,16 @@
#include "config.h"
#include "setup.h"
#include "device.h"
#include "i18n.h"
#ifndef PLUGINPARAMPATCHVERSNUM
#error "You must apply the pluginparam patch for VDR!"
#endif
#if defined(APIVERSNUM) && APIVERSNUM < 10510 && !defined(CLOSEFILTERPATCHVERSNUM)
#error "You must apply the closefilter patch for VDR!"
#if defined(APIVERSNUM) && APIVERSNUM < 10515
#error "VDR-1.5.15 API version or greater is required!"
#endif
static const char VERSION[] = "0.0.7";
static const char VERSION[] = "0.2.0";
static const char DESCRIPTION[] = trNOOP("Experience the IPTV");
class cPluginIptv : public cPlugin {
@ -100,9 +99,6 @@ bool cPluginIptv::Initialize(void)
{
debug("cPluginIptv::Initialize()\n");
// Initialize any background activities the plugin shall perform.
#if defined(APIVERSNUM) && APIVERSNUM < 10507
RegisterI18n(IptvPhrases);
#endif
IptvConfig.SetConfigDirectory(cPlugin::ConfigDirectory(PLUGIN_NAME_I18N));
return cIptvDevice::Initialize(deviceCount);
}

View File

@ -1,156 +0,0 @@
#!/usr/bin/perl
#
# po2i18n - Convert plugin po files in into i18n.c-format
#
# See the README file for copyright information and how to reach the author.
#
use strict;
use warnings;
my @LANGS = (
"en_US",
"de_DE",
"sl_SI",
"it_IT",
"nl_NL",
"pt_PT",
"fr_FR",
"nn_NO",
"fi_FI",
"pl_PL",
"es_ES",
"el_GR",
"sv_SE",
"ro_RO",
"hu_HU",
"ca_ES",
"ru_RU",
"hr_HR",
"et_EE",
"da_DK",
"cs_CZ",
"tr_TR"
);
my %VERS = (
"en_US" => 10200,
"de_DE" => 10200,
"sl_SI" => 10200,
"it_IT" => 10200,
"nl_NL" => 10200,
"pt_PT" => 10200,
"fr_FR" => 10200,
"nn_NO" => 10200,
"fi_FI" => 10200,
"pl_PL" => 10200,
"es_ES" => 10200,
"el_GR" => 10200,
"sv_SE" => 10200,
"ro_RO" => 10200,
"hu_HU" => 10200,
"ca_ES" => 10200,
"ru_RU" => 10302,
"hr_HR" => 10307,
"et_EE" => 10313,
"da_DK" => 10316,
"cs_CZ" => 10342,
"tr_TR" => 10502
);
my %strings;
foreach my $lang (@LANGS) { $strings{$lang} = { }; }
sub LoadLanguage(*) {
my ($lang) = @_;
if (!open FILE, "<", "po/$lang.po") {
return 0;
}
my $msgid = "";
my $msgstr = "";
my $last = 0; # 0=init, 1=msgid was last, 2=msgstr was last
while (<FILE>) {
chomp;
my $line = $_;
if ($line =~ /^msgid "(.*)"$/) {
if ($last eq 2) {
$strings{$lang}->{$msgid} = $msgstr;
$strings{"en_US"}->{$msgid} = $msgid;
}
$msgid = $1;
$last = 1;
} elsif ($line =~ /^msgstr "(.*)"/) {
$msgstr = $1;
$last = 2;
} elsif ($line =~ /^"(.*)"/) {
if ($last eq 1) {
$msgid = $msgid . $1;
} elsif ($last eq 2) {
$msgstr = $msgstr . $1;
}
}
}
if ($last eq 2) {
$strings{$lang}->{$msgid} = $msgstr;
$strings{"en_US"}->{$msgid} = $msgid;
}
close FILE;
}
foreach my $lang (@LANGS) {
LoadLanguage($lang);
}
my @msgids = sort keys %{$strings{"en_US"}};
my $silent = 0;
while (<>) {
my $line = $_;
if ($line =~ /^\/\/ START I18N/) {
print "// START I18N - automatically generated by po2i18n.pl\n";
for my $msgid (@msgids) {
next if $msgid eq "";
my $head = " { ";
my $endif = "";
my $versnum = 10200;
for my $lang (@LANGS) {
if ($VERS{$lang} ne $versnum) {
$versnum = $VERS{$lang};
print $endif;
print "#if VDRVERSNUM >= $versnum\n";
$endif = "#endif\n";
}
my $msgstr = $strings{$lang}->{$msgid};
$msgstr = "" if !defined $msgstr;
print "$head\"$msgstr\",\n";
$head = " ";
}
print $endif;
print " },\n";
}
$silent = 1;
}
if (!$silent) { print $line; }
if ($line =~ /^\/\/ END I18N/) {
print "// END I18N - automatically generated by po2i18n.pl\n";
$silent = 0;
}
}

40
setup.c
View File

@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: setup.c,v 1.56 2008/02/18 16:50:07 rahrenbe Exp $
* $Id: setup.c,v 1.57 2008/02/19 22:29:02 rahrenbe Exp $
*/
#include <string.h>
@ -219,12 +219,8 @@ void cIptvMenuEditChannel::SetChannelData(cChannel *Channel)
param = cString::sprintf("IPTV|S%dP%d|UDP|%s|%d", data.sidscan, data.pidscan, data.location, data.parameter);
break;
}
#if defined(APIVERSNUM) && APIVERSNUM < 10510
Channel->SetPids(data.vpid, data.ppid, data.apid, alangs, data.dpid, dlangs, data.tpid);
#else
char slangs[MAXSPIDS][MAXLANGCODE2] = { "" };
Channel->SetPids(data.vpid, data.ppid, data.apid, alangs, data.dpid, dlangs, data.spid, slangs, data.tpid);
#endif
Channel->SetCaIds(data.caids);
Channel->SetId(data.nid, data.tid, data.sid, data.rid);
Channel->SetName(data.name, "", "IPTV");
@ -241,29 +237,17 @@ void cIptvMenuEditChannel::Setup(void)
eProtocolCount, protocols));
switch (data.protocol) {
case eProtocolFILE:
#if defined(APIVERSNUM) && APIVERSNUM < 10511
Add(new cMenuEditStrItem(trVDR("File"), data.location, sizeof(data.location), trVDR(FileNameChars)));
#else
Add(new cMenuEditStrItem(trVDR("File"), data.location, sizeof(data.location)));
#endif
Add(new cMenuEditIntItem(tr("Delay (ms)"), &data.parameter, 0, 0xFFFF));
break;
case eProtocolEXT:
#if defined(APIVERSNUM) && APIVERSNUM < 10511
Add(new cMenuEditStrItem(tr("Script"), data.location, sizeof(data.location), trVDR(FileNameChars)));
#else
Add(new cMenuEditStrItem(tr("Script"), data.location, sizeof(data.location)));
#endif
Add(new cMenuEditIntItem(tr("Parameter"), &data.parameter, 0, 0xFFFF));
break;
case eProtocolHTTP:
case eProtocolUDP:
default:
#if defined(APIVERSNUM) && APIVERSNUM < 10511
Add(new cMenuEditStrItem(tr("Address"), data.location, sizeof(data.location), trVDR(FileNameChars)));
#else
Add(new cMenuEditStrItem(tr("Address"), data.location, sizeof(data.location)));
#endif
Add(new cMenuEditIntItem(tr("Port"), &data.parameter, 0, 0xFFFF));
break;
}
@ -273,11 +257,7 @@ void cIptvMenuEditChannel::Setup(void)
Add(sidScanItem);
Add(new cMenuEditBoolItem(tr("Scan pids"), &data.pidscan));
// Normal settings
#if defined(APIVERSNUM) && APIVERSNUM < 10511
Add(new cMenuEditStrItem(trVDR("Name"), data.name, sizeof(data.name), trVDR(FileNameChars)));
#else
Add(new cMenuEditStrItem(trVDR("Name"), data.name, sizeof(data.name)));
#endif
Add(new cMenuEditIntItem(trVDR("Frequency"), &data.frequency));
Add(new cMenuEditIntItem(trVDR("Vpid"), &data.vpid, 0, 0x1FFF));
Add(new cMenuEditIntItem(trVDR("Ppid"), &data.ppid, 0, 0x1FFF));
@ -285,10 +265,8 @@ void cIptvMenuEditChannel::Setup(void)
Add(new cMenuEditIntItem(trVDR("Apid2"), &data.apid[1], 0, 0x1FFF));
Add(new cMenuEditIntItem(trVDR("Dpid1"), &data.dpid[0], 0, 0x1FFF));
Add(new cMenuEditIntItem(trVDR("Dpid2"), &data.dpid[1], 0, 0x1FFF));
#if defined(APIVERSNUM) && APIVERSNUM >= 10510
Add(new cMenuEditIntItem(trVDR("Spid1"), &data.spid[0], 0, 0x1FFF));
Add(new cMenuEditIntItem(trVDR("Spid2"), &data.spid[1], 0, 0x1FFF));
#endif
Add(new cMenuEditIntItem(trVDR("Tpid"), &data.tpid, 0, 0x1FFF));
Add(new cMenuEditIntItem(trVDR("CA"), &data.caids[0], 0, 0xFFFF));
Add(new cMenuEditIntItem(trVDR("Sid"), &data.sid, 1, 0xFFFF));
@ -690,42 +668,28 @@ void cIptvPluginSetup::Setup(void)
int current = Current();
Clear();
#if defined(APIVERSNUM) && APIVERSNUM >= 10513
help.Clear();
#endif
Add(new cMenuEditIntItem( tr("TS buffer size [MB]"), &tsBufferSize, 1, 4));
#if defined(APIVERSNUM) && APIVERSNUM >= 10513
help.Append(tr("Define a ringbuffer size for transport streams in megabytes.\n\nSmaller sizes help memory consumption, but are more prone to buffer overflows."));
#endif
Add(new cMenuEditIntItem( tr("TS buffer prefill ratio [%]"), &tsBufferPrefill, 0, 40));
#if defined(APIVERSNUM) && APIVERSNUM >= 10513
help.Append(tr("Define a prefill ratio of the ringbuffer for transport streams before data is transferred to VDR.\n\nThis is useful if streaming media over a slow or unreliable connection."));
#endif
Add(new cMenuEditIntItem( tr("EXT protocol base port"), &extProtocolBasePort, 0, 0xFFF7));
#if defined(APIVERSNUM) && APIVERSNUM >= 10513
help.Append(tr("Define a base port used by EXT protocol.\n\nThe port range is defined by the number of IPTV devices. This setting sets the port which is listened for connections from external applications when using the EXT protocol."));
#endif
Add(new cMenuEditBoolItem(tr("Use section filtering"), &sectionFiltering));
#if defined(APIVERSNUM) && APIVERSNUM >= 10513
help.Append(tr("Define whether the section filtering shall be used.\n\nSection filtering means that IPTV plugin tries to parse and provide VDR with secondary data about the currently active stream. VDR can then use this data for providing various functionalities such as automatic pid change detection and EPG etc.\nEnabling this feature does not affect streams that do not contain section data."));
#endif
if (sectionFiltering) {
Add(new cMenuEditIntItem( tr("Disable filters"), &numDisabledFilters, 0, SECTION_FILTER_TABLE_SIZE));
#if defined(APIVERSNUM) && APIVERSNUM >= 10513
help.Append(tr("Define number of section filters to be disabled.\n\nCertain section filters might cause some unwanted behaviour to VDR such as time being falsely synchronized. By black-listing the filters here useful section data can be left intact for VDR to process."));
#endif
for (int i = 0; i < numDisabledFilters; ++i) {
// TRANSLATORS: note the singular!
Add(new cMenuEditStraItem(tr("Disable filter"), &disabledFilterIndexes[i], SECTION_FILTER_TABLE_SIZE, disabledFilterNames));
#if defined(APIVERSNUM) && APIVERSNUM >= 10513
help.Append(tr("Define an ill-behaving filter to be blacklisted."));
#endif
}
}
@ -759,10 +723,8 @@ eOSState cIptvPluginSetup::ProcessKey(eKeys Key)
switch (Key) {
case kRed: return EditChannel();
case kBlue: return ShowInfo();
#if defined(APIVERSNUM) && APIVERSNUM >= 10513
case kInfo: if (Current() < help.Size())
return AddSubMenu(new cMenuText(cString::sprintf("%s - %s '%s'", tr("Help"), trVDR("Plugin"), PLUGIN_NAME_I18N), help[Current()]));
#endif
default: state = osContinue;
}
}

View File

@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: setup.h,v 1.20 2008/02/01 21:54:24 rahrenbe Exp $
* $Id: setup.h,v 1.21 2008/02/19 22:29:02 rahrenbe Exp $
*/
#ifndef __IPTV_SETUP_H
@ -22,9 +22,7 @@ private:
int numDisabledFilters;
int disabledFilterIndexes[SECTION_FILTER_TABLE_SIZE];
const char *disabledFilterNames[SECTION_FILTER_TABLE_SIZE];
#if defined(APIVERSNUM) && APIVERSNUM >= 10513
cVector<const char*> help;
#endif
eOSState EditChannel(void);
eOSState ShowInfo(void);