[vdr-plugin-eepg] 03/05: Imported Upstream version 0.0.5+git20150215

Tobias Grimm tiber-guest at moszumanska.debian.org
Sun Feb 15 19:14:07 UTC 2015


This is an automated email from the git hooks/post-receive script.

tiber-guest pushed a commit to branch master
in repository vdr-plugin-eepg.

commit 8c67ff2c132c65e1d8624a882f8570572150b819
Author: etobi <git at e-tobi.net>
Date:   Sun Feb 15 20:09:07 2015 +0100

    Imported Upstream version 0.0.5+git20150215
---
 .pc/.dpkg-source-unapply |   0
 .pc/.quilt_patches       |   1 -
 .pc/.quilt_series        |   1 -
 .pc/.version             |   1 -
 Makefile                 | 114 ++++++++++++++++++++++++-----------------------
 README                   |   1 +
 eepg.c                   |  70 ++++++++++++++---------------
 eit2.c                   |   7 +--
 eit2.h                   |   8 +++-
 epghandler.c             |   4 +-
 util.c                   |   1 -
 util.h                   |   4 +-
 12 files changed, 107 insertions(+), 105 deletions(-)

diff --git a/.pc/.dpkg-source-unapply b/.pc/.dpkg-source-unapply
deleted file mode 100644
index e69de29..0000000
diff --git a/.pc/.quilt_patches b/.pc/.quilt_patches
deleted file mode 100644
index 6857a8d..0000000
--- a/.pc/.quilt_patches
+++ /dev/null
@@ -1 +0,0 @@
-debian/patches
diff --git a/.pc/.quilt_series b/.pc/.quilt_series
deleted file mode 100644
index c206706..0000000
--- a/.pc/.quilt_series
+++ /dev/null
@@ -1 +0,0 @@
-series
diff --git a/.pc/.version b/.pc/.version
deleted file mode 100644
index 0cfbf08..0000000
--- a/.pc/.version
+++ /dev/null
@@ -1 +0,0 @@
-2
diff --git a/Makefile b/Makefile
index 49e8770..c7b93d0 100644
--- a/Makefile
+++ b/Makefile
@@ -28,109 +28,111 @@ PLUGIN = eepg
 
 VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).c | awk '{ print $$6 }' | sed -e 's/[";]//g')
 
-### The C++ compiler and options:
+### The directory environment:
 
-CXX      ?= g++
-CXXFLAGS ?= -O2 -fPIC -Wall -Woverloaded-virtual
+# 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_PATH="$$PKG_CONFIG_PATH:../../.." pkg-config --variable=$(1) vdr))
+LIBDIR = $(call PKGCFG,libdir)
+LOCDIR = $(call PKGCFG,locdir)
+PLGCFG = $(call PKGCFG,plgcfg)
+#
+TMPDIR ?= /tmp
 
-### The directory environment:
+### The compiler options:
 
-VDRDIR = ../../..
-LIBDIR = ../../lib
-TMPDIR = /tmp
+export CFLAGS   = $(call PKGCFG,cflags)
+export CXXFLAGS = $(call PKGCFG,cxxflags)
 
-### Allow user defined options to overwrite defaults:
+### The version number of VDR's plugin API:
 
--include $(VDRDIR)/Make.config
--include Make.config
+APIVERSION = $(call PKGCFG,apiversion)
 
-### The version number of VDR (taken from VDR's "config.h"):
+### Allow user defined options to overwrite defaults:
 
-VDRVERSION = $(shell sed -ne '/define VDRVERSION/ s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h)
-APIVERSION = $(shell sed -ne '/define APIVERSION/ s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h)
-ifeq ($(strip $(APIVERSION)),)
-   APIVERSION = $(VDRVERSION)
-endif
+-include $(PLGCFG)
+-include Make.config
 
 ### 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 += -I$(VDRDIR)/include
 
-DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
+DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
 
 ### The object files (add further files here):
 
 OBJS = $(PLUGIN).o dish.o epghandler.o setupeepg.o equivhandler.o util.o eit2.o
 
-ifdef DBG
-CXXFLAGS += -g
-endif
+### The main target:
 
-### Internationalization (I18N):
+all: $(SOFILE)
 
-PODIR     = po
-I18Npot   = $(PODIR)/$(PLUGIN).pot
-I18Nmsgs  = $(addprefix $(LOCALEDIR)/,$(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo,$(notdir $(foreach file, $(wildcard $(PODIR)/*.po), $(basename $(file))))))
-LOCALEDIR = $(VDRDIR)/locale
+### Implicit rules:
 
-### Default Target
-default: $(OBJS)
+%.o: %.c
+	$(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
 
 ### Dependencies:
 
 MAKEDEP = $(CXX) -MM -MG
 DEPFILE = .dependencies
 $(DEPFILE): Makefile
-	@$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
+	@$(MAKEDEP) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
 
 -include $(DEPFILE)
 
-### Targets:
-
-TARGETS = libvdr-$(PLUGIN).so
-ifneq ($(shell grep -l 'Phrases' $(VDRDIR)/i18n.c),$(VDRDIR)/i18n.c)
-TARGETS += i18n
-endif
-
-all: $(TARGETS)
-.PHONY: i18n
+### Internationalization (I18N):
 
-%.o: %.c
-	$(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $<
+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
 
-libvdr-$(PLUGIN).so: $(OBJS)
-	$(CXX) $(CXXFLAGS) -shared $(OBJS) -o $@
-	@cp $@ $(LIBDIR)/$@.$(APIVERSION)
+%.mo: %.po
+	msgfmt -c -o $@ $<
 
-$(I18Npot): $(shell grep -rl '\(tr\|trNOOP\)(\".*\")' *.c $(SYSDIR))
-	xgettext -C -cTRANSLATORS --no-wrap -F -k -ktr -ktrNOOP  -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 -F --backup=none -q $@ $<
+	msgmerge -U --no-wrap --no-location --backup=none -q -N $@ $<
 	@touch $@
 
-%.mo: %.po
-	msgfmt -c -o $@ $<
+$(I18Nmsgs): $(DESTDIR)$(LOCDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo
+	install -D -m644 $< $@
+
+.PHONY: i18n
+i18n: $(I18Nmo) $(I18Npot)
+
+install-i18n: $(I18Nmsgs)
+
+### Targets:
+
+$(SOFILE): $(OBJS)
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) -o $@
 
-$(I18Nmsgs): $(LOCALEDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo
-	@mkdir -p $(dir $@)
-	cp $< $@
+install-lib: $(SOFILE)
+	install -D $^ $(DESTDIR)$(LIBDIR)/$^.$(APIVERSION)
 
-i18n: $(I18Nmsgs)
+install: install-lib install-i18n
 
-dist: clean
+dist: $(I18Npo) clean
 	@-rm -rf $(TMPDIR)/$(ARCHIVE)
 	@mkdir $(TMPDIR)/$(ARCHIVE)
 	@cp -a * $(TMPDIR)/$(ARCHIVE)
-	@tar czf $(PACKAGE).tar.gz -C $(TMPDIR) $(ARCHIVE)
+	@tar czf $(PACKAGE).tgz -C $(TMPDIR) $(ARCHIVE)
 	@-rm -rf $(TMPDIR)/$(ARCHIVE)
-	@echo Distribution package created as $(PACKAGE).tar.gz
+	@echo Distribution package created as $(PACKAGE).tgz
 
 clean:
-	@-rm -f $(OBJS) $(DEPFILE) *.so *.tar.gz core* *~
-#	@-rm -f $(PODIR)/*.mo $(PODIR)/*.pot
+	@-rm -f $(PODIR)/*.mo $(PODIR)/*.pot
+	@-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~
diff --git a/README b/README
index edde5b7..6dee8d5 100644
--- a/README
+++ b/README
@@ -113,6 +113,7 @@ This code is based on:
 * cAddEventThread from EPGFixer plugin by Matti Lehtimaki matti.lehtimaki /at/ gmail.com
 Thanks to mrgandalf, and the others who helped map NA eit.
 Thanks to VDR User for testing and providing makequiv.sh script for S72.7W channels.
+Thanks to cheesemonster for providing a patch to fix multipe device problems
 
 We wish to thank all authors for the great work they have been doing, decoding
 this EEPG data; this plugin tries to combine the best of all worlds.
diff --git a/eepg.c b/eepg.c
index fc7a5b0..8573446 100644
--- a/eepg.c
+++ b/eepg.c
@@ -52,7 +52,7 @@
 #include <stdarg.h>
 
 
-#if APIVERSNUM < 10401
+#if defined(APIVERSNUM) && APIVERSNUM < 10401
 #error You need at least VDR API version 1.4.1 for this plugin
 #endif
 #if APIVERSNUM < 10507
@@ -175,7 +175,7 @@ private:
   bool EndChannels, EndThemes; //only used for ??
   int MHWStartTime; //only used for MHW1
   bool ChannelsOk;
-  //int Format; //the format that this filter currently is processing
+  EFormat Format; //the format that this filter currently is processing
   std::map < int, int >ChannelSeq; // ChannelSeq[ChannelId] returns the recordnumber of the channel
 
   Summary_t *Summaries[MAX_TITLES];
@@ -194,6 +194,8 @@ private:
 
   void NextPmt (void);
   void ProccessContinuous(u_short Pid, u_char Tid, int Length, const u_char *Data);
+  bool load_sky_file (const char *filename);
+  int sky_huffman_decode (const u_char * Data, int Length, unsigned char *DecodeText);
 protected:
   virtual void Process (u_short Pid, u_char Tid, const u_char * Data, int Length);
   virtual void AddFilter (u_short Pid, u_char Tid);
@@ -258,7 +260,7 @@ void cFilterEEPG::SetStatus (bool On)
   if (!On) {
     FreeSummaries ();
     FreeTitles ();
-    //Format = 0;
+    Format = MHW1;
     ChannelsOk = false;
     NumberOfTables = 0;
   } else {
@@ -422,7 +424,7 @@ static bool load_freesat_file (int tableid, const char *filename)
  *  \param filename  - Filename to load
  *  \return Success of operation
  */
-static bool load_sky_file (const char *filename)
+bool cFilterEEPG::load_sky_file (const char *filename)
 {
   FILE *FileDict;
   char *Line;
@@ -646,7 +648,7 @@ char *freesat_huffman_decode (const unsigned char *src, size_t size)
   return NULL;
 }
 
-int sky_huffman_decode (const u_char * Data, int Length, unsigned char *DecodeText)
+int cFilterEEPG::sky_huffman_decode (const u_char * Data, int Length, unsigned char *DecodeText)
 {
   sNodeH *nH, H=(Format==SKY_IT)?*sky_tables[0]:*sky_tables[1];
   int i;
@@ -793,8 +795,13 @@ bool cFilterEEPG::GetThemesSKYBOX (void) //TODO can't we read this from the DVB
  * \brief Initialize the Huffman dictionaries if they are not already initialized.
  *
  */
+static cMutex InitDictionary_mutex;
+
 bool cFilterEEPG::InitDictionary (void)
 {
+  // This function must be serialised because it updates sky_tables and tables
+  // which are both globals.
+  cMutexLock MutexLock(&InitDictionary_mutex);
   string FileName = cSetupEEPG::getInstance()->getConfDir();
   switch (Format) {
   case SKY_IT:
@@ -832,28 +839,6 @@ bool cFilterEEPG::InitDictionary (void)
   return true;
 }
 
-//void decodeText2 (const unsigned char *from, int len, char *buffer, int buffsize)
-//{
-//  if (from[0] == 0x1f) {
-//    char *temp = freesat_huffman_decode (from, len);
-//    if (temp) {
-//      len = strlen (temp);
-//      len = len < buffsize - 1 ? len : buffsize - 1;
-//      strncpy (buffer, temp, len);
-//      buffer[len] = 0;
-//      free (temp);
-//      return;
-//    }
-//  }
-//
-//  SI::String convStr;
-//  SI::CharArray charArray;
-//  charArray.assign(from, len);
-//  convStr.setData(charArray, len);
-//  //LogE(5, prep("decodeText2 from %s - length %d"), from, len);
-//  convStr.getText(buffer,  buffsize);
-//  //LogE(5, prep("decodeText2 buffer %s - buffsize %d"), buffer, buffsize);
-//}
 
 /**
  * \brief Get MHW channels
@@ -2751,7 +2736,7 @@ void cFilterEEPG::ProccessContinuous(u_short Pid, u_char Tid, int Length, const
   cSchedules *Schedules = (cSchedules*)(cSchedules::Schedules(SchedulesLock));
   //Look for other satelite positions only if Dish/Bell ExpressVU for the moment hardcoded pid check
   if(Schedules)
-    SI::cEIT2 EIT(Schedules, Source(), Tid, Data, Pid == EIT_PID);
+    SI::cEIT2 EIT(Schedules, Source(), Tid, Data, Format, Pid == EIT_PID);
 
   else//cEIT EIT (Schedules, Source (), Tid, Data);
   {
@@ -2762,7 +2747,7 @@ void cFilterEEPG::ProccessContinuous(u_short Pid, u_char Tid, int Length, const
     cSchedulesLock SchedulesLock;
     cSchedules *Schedules = (cSchedules*)(cSchedules::Schedules(SchedulesLock));
     if(Schedules)
-      SI::cEIT2 EIT(Schedules, Source(), Tid, Data, Pid == EIT_PID, true);
+      SI::cEIT2 EIT(Schedules, Source(), Tid, Data, Format, Pid == EIT_PID, true);
 
     //cEIT EIT (Schedules, Source (), Tid, Data, true);
   }
@@ -3442,7 +3427,7 @@ private:
   struct {
     cFilterEEPG *filter;
     cDevice *device;
-  } epg[MAXDVBDEVICES];
+  } epg[MAXDEVICES];
 
   void CheckCreateFile(const char* Name, const char *fileContent[]);
 
@@ -3468,6 +3453,7 @@ cPluginEEPG::cPluginEEPG (void)
 void cPluginEEPG::CheckCreateFile(const char* Name, const char *fileContent[])
 {
   FILE *File;
+  bool isSkyTheme = fileContent == SkyItThemes || fileContent == SkyUkThemes;
   string FileName = string(cSetupEEPG::getInstance()->getConfDir()) + "/" + Name;
   File = fopen(FileName.c_str(), "r");
   if (File == NULL) {
@@ -3476,11 +3462,23 @@ void cPluginEEPG::CheckCreateFile(const char* Name, const char *fileContent[])
     if (File == NULL) {
       LogE (0, prep("Error creating file '%s', %s"), FileName.c_str(), strerror (errno));
     } else {
-      int i = 0;
-      while (fileContent[i] != NULL) {
-        fprintf (File, "%s\n", fileContent[i]);
-        i++;
+      if (!isSkyTheme) {
+        int i = 0;
+        while (fileContent[i] != NULL) {
+          fprintf (File, "%s\n", fileContent[i]);
+          i++;
+        }
+      } else {
+        for (int i = 0; i < 256; i++) {
+          if (fileContent[i]) {
+            fprintf (File, "0x%02x=%s\n", i, fileContent[i]);
+          }
+          else {
+            fprintf (File, "0x%02x=\n", i);
+          }
+        }
       }
+
       LogI (0, prep("Success creating file '%s'"), FileName.c_str());
       fclose (File);
     }
@@ -3494,7 +3492,7 @@ bool cPluginEEPG::Start (void)
 #if APIVERSNUM < 10507
   RegisterI18n (Phrases);
 #endif
-  for (int i = 0; i < MAXDVBDEVICES; i++) {
+  for (int i = 0; i < MAXDEVICES; i++) {
     cDevice *dev = cDevice::GetDevice (i);
     if (dev) {
       epg[i].device = dev;
@@ -3560,7 +3558,7 @@ bool cPluginEEPG::Start (void)
 
 void cPluginEEPG::Stop (void)
 {
-  for (int i = 0; i < MAXDVBDEVICES; i++) {
+  for (int i = 0; i < MAXDEVICES; i++) {
     cDevice *dev = epg[i].device;
     if (dev)
       dev->Detach (epg[i].filter);
diff --git a/eit2.c b/eit2.c
index 3980dba..4e813af 100644
--- a/eit2.c
+++ b/eit2.c
@@ -9,7 +9,6 @@
 #include <string>
 #include <vdr/config.h>
 #include "log.h"
-#include "util.h"
 #include "dish.h"
 #include "equivhandler.h"
 
@@ -435,10 +434,11 @@ void cEIT2::ProcessEventDescriptors(bool ExternalData, int Source,
     channel->SetLinkChannels (LinkChannels);
 }
 
-cEIT2::cEIT2 (cSchedules * Schedules, int Source, u_char Tid, const u_char * Data, bool isEITPid, bool OnlyRunningStatus)
+cEIT2::cEIT2 (cSchedules * Schedules, int Source, u_char Tid, const u_char * Data, EFormat format, bool isEITPid, bool OnlyRunningStatus)
 :  SI::EIT (Data, false)
 , OnlyRunningStatus(OnlyRunningStatus)
 , Schedules(Schedules)
+, Format(format)
 {
 
   //LogD(2, prep("cEIT2::cEIT2"));
@@ -563,13 +563,14 @@ cEIT2::cEIT2 (cSchedules * Schedules, int Source, u_char Tid, const u_char * Dat
 }
 //end of cEIT2
 
-cEIT2::cEIT2 (cSchedule * Schedule)
+cEIT2::cEIT2 (cSchedule * Schedule, EFormat format)
 : Empty(true)
 , Modified(false)
 , OnlyRunningStatus(false)
 , SegmentStart(0)
 , SegmentEnd(0)
 , Schedules(NULL)
+, Format(format)
 {
   //LogD(2, prep("cEIT2::cEIT2"));
   //    if (Tid > 0 && (Format == DISH_BEV || (SetupPE->ProcessEIT && isEITPid))) Tid--;
diff --git a/eit2.h b/eit2.h
index 7686672..c85a9d3 100644
--- a/eit2.h
+++ b/eit2.h
@@ -4,7 +4,9 @@
 #include <libsi/descriptor.h>
 #include <libsi/si.h>
 #include <vdr/epg.h>
+#include "util.h"
 
+using namespace util;
 namespace SI
 {
 enum DescriptorTagExt {
@@ -22,9 +24,10 @@ extern bool SystemCharacterTableIsSingleByte;*/
 class cEIT2:public SI::EIT
 {
 public:
-  cEIT2(cSchedules * Schedules, int Source, u_char Tid, const u_char * Data, bool isEITPid = false,
+  cEIT2(cSchedules * Schedules, int Source, u_char Tid, const u_char * Data,
+        EFormat format, bool isEITPid = false,
         bool OnlyRunningStatus = false);
-  cEIT2 (cSchedule * Schedule);
+  cEIT2 (cSchedule * Schedule, EFormat format);
   //protected:
   //  void updateEquivalent(cSchedules * Schedules, tChannelID channelID, cEvent *pEvent);
   cEvent* ProcessEitEvent(cSchedule *Schedule, const SI::EIT::Event *EitEvent, uchar TableID, uchar Version);
@@ -42,6 +45,7 @@ private:
   time_t SegmentStart;
   time_t SegmentEnd;
   cSchedules* Schedules;
+  EFormat Format;
   cChannel* channel;
 
 };
diff --git a/epghandler.c b/epghandler.c
index 49c89e4..4b67fe3 100644
--- a/epghandler.c
+++ b/epghandler.c
@@ -34,9 +34,9 @@ bool cEEpgHandler::HandleEitEvent(cSchedule* Schedule,
   int nid = Schedule->ChannelID().Nid();
   if ((nid >= 0x1001 && nid <= 0x100B) || nid == 0x101 || nid == 0x100) {
     //Set the Format for Eit events so that the new lines are not erased with FixEpgBugs
-    if (Format != DISH_BEV) Format = DISH_BEV;
+    EFormat Format = DISH_BEV;
 
-    SI::cEIT2 eit2(Schedule);
+    SI::cEIT2 eit2(Schedule, Format);
     eit2.ProcessEitEvent(Schedule, EitEvent, TableID, Version);
     return true;
   }
diff --git a/util.c b/util.c
index 415f213..4fc0c48 100644
--- a/util.c
+++ b/util.c
@@ -26,7 +26,6 @@ int YesterdayEpochUTC;
 struct hufftab *tables[2][128];
 int table_size[2][128];
 
-EFormat Format;
 cEquivHandler* EquivHandler;
 
 cChannel *GetChannelByID(tChannelID & channelID, bool searchOtherPos)
diff --git a/util.h b/util.h
index dec5b70..0113249 100644
--- a/util.h
+++ b/util.h
@@ -32,7 +32,7 @@ extern int Yesterday;
 extern int YesterdayEpoch;
 extern int YesterdayEpochUTC;
 
-extern enum EFormat
+enum EFormat
 {
 //First all batchmode, load ONCE protocols:
   MHW1 = 0,
@@ -47,7 +47,7 @@ extern enum EFormat
   EIT,
 //the highest number of EPG-formats that is supported by this plugin
   HIGHEST_FORMAT = EIT
-} Format;
+};
 
 extern cEquivHandler* EquivHandler;
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-vdr-dvb/vdr-plugin-eepg.git



More information about the pkg-vdr-dvb-changes mailing list