diff options
| author | bball <bball@octorok.org> | 2009-01-28 14:58:42 -0800 |
|---|---|---|
| committer | bball <bball@octorok.org> | 2009-01-28 14:58:42 -0800 |
| commit | fae9cc04c10572bdb687a0207a20c85ea1aa51b1 (patch) | |
| tree | 804ff37f33170cc93fff6526b94d4f4290c7720d | |
| parent | 78599ca99ec812085474dff712c3e41bd1921c57 (diff) | |
| download | vdr-plugin-yaepghd-fae9cc04c10572bdb687a0207a20c85ea1aa51b1.tar.gz vdr-plugin-yaepghd-fae9cc04c10572bdb687a0207a20c85ea1aa51b1.tar.bz2 | |
- Incorporated Rolf's patch, see HISTORY for changes.
| -rw-r--r-- | HISTORY | 10 | ||||
| -rw-r--r-- | Makefile | 16 | ||||
| -rw-r--r-- | i18n.c | 433 | ||||
| -rw-r--r-- | i18n.h | 16 | ||||
| -rw-r--r-- | patches/vdr-1.5.18-yaepg-core.diff | 66 | ||||
| -rw-r--r-- | patches/vdr-1.6.0-yaepghd.patch | 78 | ||||
| -rw-r--r-- | po/de_DE.po | 93 | ||||
| -rw-r--r-- | po/fi_FI.po | 94 | ||||
| -rw-r--r-- | yaepghd.c | 218 |
9 files changed, 414 insertions, 610 deletions
@@ -1,8 +1,16 @@ VDR Plugin 'yaepghd' Revision History ------------------------------------- -2008-06-22: Version 0.0.1 +2009-xx-xx: Version 0.0.1 - Initial revision. - Rewrite of the yaepg plugin. - Support for themes. +- Added gettext support (Rolf Ahrenberg). +- Updated and added patch for vdr-1.6.0 (Rolf Ahrenberg). +- Changed cReelVidWin to use cThread (Rolf Ahrenberg). +- Added support for MainMenuHooks patch (Rolf Ahrenberg). +- Renamed REEL_EHD to YAEPGHD_REEL_EHD and moved the setting into Makefile (Rolf Ahrenberg). +- Fixed couple of crash bugs (Rolf Ahrenberg). + +TODO: Video Window doesn't scale back to normal when quiting the plugin @@ -3,6 +3,9 @@ # # $Id$ +# Use Reel eHD card +#YAEPGHD_REEL_EHD = 1 + # 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. @@ -41,15 +44,22 @@ PACKAGE = vdr-$(ARCHIVE) ### Includes and Defines (add further entries here): -INCLUDES += -I$(VDRDIR)/include -I/usr/include/ImageMagick -I. +INCLUDES += -I$(VDRDIR)/include -I. + +LIBS = -lMagick++ -LIBS = -lMagick++ -L/usr/local/lib -lcurl +INCLUDES += $(shell pkg-config --cflags-only-I Magick++) DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"' +ifdef YAEPGHD_REEL_EHD +DEFINES += -DYAEPGHD_REEL_EHD +LIBS += -lcurl +endif + ### The object files (add further files here): -OBJS = $(PLUGIN).o i18n.o +OBJS = $(PLUGIN).o ### The main target: @@ -1,433 +0,0 @@ -/* - * i18n.c: Internationalization - * - * See the README file for copyright information and how to reach the author. - * - * $Id$ - */ - -#include "i18n.h" - -const tI18nPhrase Phrases[] = { - { "No Info",// English - "Keine Daten verfügbar.",// Deutsch - "",// Slovenski - "",// Italiano - "",// Nederlands - "",// Português - "",// Français - "",// Norsk - "",// suomi - "",// Polski - "",// Españo - "",// ÅëëçíéêÜ - "",// Svenska - "",// Romaneste - "",// Magyar - "",// Català -#if VDRVERSNUM >= 10300 - "" // ÀãááÚØÙ -#endif - }, - { "TV output format", - "TV Ausgabe", - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO -#if VDRVERSNUM >= 10300 - "" // TODO -#endif - }, - { "Hide mainmenu entry", - "Hauptmenüeintrag verstecken", - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO -#if VDRVERSNUM >= 10300 - "" // TODO -#endif - }, - { "Change channel automatically", - "Kanal automatisch wechseln", - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO -#if VDRVERSNUM >= 10300 - "" // TODO -#endif - }, - { "Start", - "Anfang", - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO -#if VDRVERSNUM >= 10300 - "" // TODO -#endif - }, - { "Stop", - "Halt", - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO -#if VDRVERSNUM >= 10300 - "" // TODO -#endif - }, - { "Frequency", - "Frequenz", - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO -#if VDRVERSNUM >= 10300 - "" // TODO -#endif - }, - { "Every", - "Jeden", - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO -#if VDRVERSNUM >= 10300 - "" // TODO -#endif - }, - { "Mon", - "Mo", - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO -#if VDRVERSNUM >= 10300 - "" // TODO -#endif - }, - { "Tue", - "Di", - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO -#if VDRVERSNUM >= 10300 - "" // TODO -#endif - }, - { "Wed", - "Mi", - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO -#if VDRVERSNUM >= 10300 - "" // TODO -#endif - }, - { "Thr", - "Do", - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO -#if VDRVERSNUM >= 10300 - "" // TODO -#endif - }, - { "Fri", - "Fr", - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO -#if VDRVERSNUM >= 10300 - "" // TODO -#endif - }, - { "Sat", - "Sa", - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO -#if VDRVERSNUM >= 10300 - "" // TODO -#endif - }, - { "Sun", - "So", - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO -#if VDRVERSNUM >= 10300 - "" // TODO -#endif - }, - { "Mon-Fri", - "Mo-Fr", - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO -#if VDRVERSNUM >= 10300 - "" // TODO -#endif - }, - { "Sun-Sat", - "So-Sa", - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO -#if VDRVERSNUM >= 10300 - "" // TODO -#endif - }, - { "Once", - "Sobald", - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO -#if VDRVERSNUM >= 10300 - "" // TODO -#endif - }, - { "Timer added", - "Timer hinzugefügt", - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO -#if VDRVERSNUM >= 10300 - "" // TODO -#endif - }, - { "Timer cancelled", - "Timer annullierte", - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO -#if VDRVERSNUM >= 10300 - "" // TODO -#endif - }, - { "Time format", - "Zeit-Format", - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO - "",// TODO -#if VDRVERSNUM >= 10300 - "" // TODO -#endif - }, - { NULL } - }; @@ -1,16 +0,0 @@ -/* - * i18n.h: Internationalization - * - * See the README file for copyright information and how to reach the author. - * - * $Id$ - */ - -#ifndef _I18N__H -#define _I18N__H - -#include <vdr/i18n.h> - -extern const tI18nPhrase Phrases[]; - -#endif //_I18N__H diff --git a/patches/vdr-1.5.18-yaepg-core.diff b/patches/vdr-1.5.18-yaepg-core.diff deleted file mode 100644 index 8182423..0000000 --- a/patches/vdr-1.5.18-yaepg-core.diff +++ /dev/null @@ -1,66 +0,0 @@ -diff -Nru vdr-1.5.18/device.h vdr-1.5.18-yaepg/device.h ---- vdr-1.5.18/device.h 2008-02-23 05:13:04.000000000 -0800 -+++ vdr-1.5.18-yaepg/device.h 2009-01-24 15:32:19.000000000 -0800 -@@ -242,12 +242,12 @@ - ///< Direction (only the sign of Direction is evaluated, positive values - ///< switch to higher channel numbers). - private: -- eSetChannelResult SetChannel(const cChannel *Channel, bool LiveView); -- ///< Sets the device to the given channel (general setup). - protected: - virtual bool SetChannelDevice(const cChannel *Channel, bool LiveView); - ///< Sets the device to the given channel (actual physical setup). - public: -+ eSetChannelResult SetChannel(const cChannel *Channel, bool LiveView); -+ ///< Sets the device to the given channel (general setup). - static int CurrentChannel(void) { return primaryDevice ? currentChannel : 0; } - ///< Returns the number of the current channel on the primary device. - static void SetCurrentChannel(const cChannel *Channel) { currentChannel = Channel ? Channel->Number() : 0; } -diff -Nru vdr-1.5.18/dvbosd.c vdr-1.5.18-yaepg/dvbosd.c ---- vdr-1.5.18/dvbosd.c 2007-09-16 01:55:54.000000000 -0700 -+++ vdr-1.5.18-yaepg/dvbosd.c 2009-01-24 15:32:19.000000000 -0800 -@@ -83,6 +83,10 @@ - shown = false; - } - } -+ if (vidWin.bpp != 0) { -+ Cmd(OSD_SetWindow, 0, 5); -+ Cmd(OSD_Close); -+ } - } - - eOsdError cDvbOsd::CanHandleAreas(const tArea *Areas, int NumAreas) -@@ -198,6 +202,11 @@ - Cmd(OSD_SetWindow, 0, i + 1); - Cmd(OSD_MoveWindow, 0, Left() + Bitmap->X0(), Top() + Bitmap->Y0()); - } -+ if (vidWin.bpp != 0) { -+ Cmd(OSD_SetWindow, 0, 5); -+ Cmd(OSD_OpenRaw, vidWin.bpp, vidWin.x1, vidWin.y1, -+ vidWin.x2, vidWin.y2, (void *)0); -+ } - shown = true; - } - } -diff -Nru vdr-1.5.18/osd.c vdr-1.5.18-yaepg/osd.c ---- vdr-1.5.18/osd.c 2007-10-12 05:38:36.000000000 -0700 -+++ vdr-1.5.18-yaepg/osd.c 2009-01-24 15:34:01.000000000 -0800 -@@ -730,6 +730,7 @@ - width = height = 0; - level = Level; - active = false; -+ vidWin.bpp = 0; - for (int i = 0; i < Osds.Size(); i++) { - if (Osds[i]->level > level) { - Osds.Insert(this, i); -diff -Nru vdr-1.5.18/osd.h vdr-1.5.18-yaepg/osd.h ---- vdr-1.5.18/osd.h 2007-10-12 07:28:44.000000000 -0700 -+++ vdr-1.5.18-yaepg/osd.h 2009-01-24 15:32:19.000000000 -0800 -@@ -400,6 +400,7 @@ - ///< 7: vertical, falling, upper - virtual void Flush(void); - ///< Actually commits all data to the OSD hardware. -+ tArea vidWin; - }; - - class cOsdProvider { diff --git a/patches/vdr-1.6.0-yaepghd.patch b/patches/vdr-1.6.0-yaepghd.patch new file mode 100644 index 0000000..426b709 --- /dev/null +++ b/patches/vdr-1.6.0-yaepghd.patch @@ -0,0 +1,78 @@ +diff -Nru vdr-1.6.0-vanilla/config.h vdr-1.6.0-yaepghd/config.h +--- vdr-1.6.0-vanilla/config.h 2008-03-23 12:26:10.000000000 +0200 ++++ vdr-1.6.0-yaepghd/config.h 2009-01-24 23:34:01.000000000 +0200 +@@ -30,6 +30,8 @@ + #define APIVERSION "1.6.0" + #define APIVERSNUM 10600 // Version * 10000 + Major * 100 + Minor + ++#define YAEPGHDVERSNUM 1 ++ + // When loading plugins, VDR searches them by their APIVERSION, which + // may be smaller than VDRVERSION in case there have been no changes to + // VDR header files since the last APIVERSION. This allows compiled +diff -Nru vdr-1.6.0-vanilla/device.h vdr-1.6.0-yaepghd/device.h +--- vdr-1.6.0-vanilla/device.h 2008-02-23 15:13:04.000000000 +0200 ++++ vdr-1.6.0-yaepghd/device.h 2009-01-24 23:34:01.000000000 +0200 +@@ -242,12 +242,12 @@ + ///< Direction (only the sign of Direction is evaluated, positive values + ///< switch to higher channel numbers). + private: +- eSetChannelResult SetChannel(const cChannel *Channel, bool LiveView); +- ///< Sets the device to the given channel (general setup). + protected: + virtual bool SetChannelDevice(const cChannel *Channel, bool LiveView); + ///< Sets the device to the given channel (actual physical setup). + public: ++ eSetChannelResult SetChannel(const cChannel *Channel, bool LiveView); ++ ///< Sets the device to the given channel (general setup). + static int CurrentChannel(void) { return primaryDevice ? currentChannel : 0; } + ///< Returns the number of the current channel on the primary device. + static void SetCurrentChannel(const cChannel *Channel) { currentChannel = Channel ? Channel->Number() : 0; } +diff -Nru vdr-1.6.0-vanilla/dvbosd.c vdr-1.6.0-yaepghd/dvbosd.c +--- vdr-1.6.0-vanilla/dvbosd.c 2007-09-16 11:55:54.000000000 +0300 ++++ vdr-1.6.0-yaepghd/dvbosd.c 2009-01-24 23:40:51.000000000 +0200 +@@ -53,6 +53,10 @@ + osdMem = cap.val; + #endif + } ++ if (vidWin.bpp != 0) { ++ Cmd(OSD_SetWindow, 0, 5); ++ Cmd(OSD_Close); ++ } + } + + cDvbOsd::~cDvbOsd() +@@ -198,6 +202,10 @@ + Cmd(OSD_SetWindow, 0, i + 1); + Cmd(OSD_MoveWindow, 0, Left() + Bitmap->X0(), Top() + Bitmap->Y0()); + } ++ if (vidWin.bpp != 0) { ++ Cmd(OSD_SetWindow, 0, 5); ++ Cmd(OSD_OpenRaw, vidWin.bpp, vidWin.x1, vidWin.y1, vidWin.x2, vidWin.y2, NULL); ++ } + shown = true; + } + } +diff -Nru vdr-1.6.0-vanilla/osd.c vdr-1.6.0-yaepghd/osd.c +--- vdr-1.6.0-vanilla/osd.c 2007-10-12 15:38:36.000000000 +0300 ++++ vdr-1.6.0-yaepghd/osd.c 2009-01-24 23:34:01.000000000 +0200 +@@ -730,6 +730,7 @@ + width = height = 0; + level = Level; + active = false; ++ vidWin.bpp = 0; + for (int i = 0; i < Osds.Size(); i++) { + if (Osds[i]->level > level) { + Osds.Insert(this, i); +diff -Nru vdr-1.6.0-vanilla/osd.h vdr-1.6.0-yaepghd/osd.h +--- vdr-1.6.0-vanilla/osd.h 2007-10-12 17:28:44.000000000 +0300 ++++ vdr-1.6.0-yaepghd/osd.h 2009-01-24 23:46:35.000000000 +0200 +@@ -269,6 +269,8 @@ + int left, top, width, height; + uint level; + bool active; ++public: ++ tArea vidWin; + protected: + cOsd(int Left, int Top, uint Level); + ///< Initializes the OSD with the given coordinates. diff --git a/po/de_DE.po b/po/de_DE.po new file mode 100644 index 0000000..029baf1 --- /dev/null +++ b/po/de_DE.po @@ -0,0 +1,93 @@ +# VDR plugin language source file. +# Copyright (C) 2009 bball <bball950@yahoo.com> +# This file is distributed under the same license as the yaepghd package. +# +msgid "" +msgstr "" +"Project-Id-Version: Yaepghd 0.0.1\n" +"Report-Msgid-Bugs-To: <see README>\n" +"POT-Creation-Date: 2009-01-28 20:31+0200\n" +"PO-Revision-Date: 2009-01-28 10:51+0200\n" +"Last-Translator: Klaus Schmidinger <kls@cadsoft.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 "No Info" +msgstr "Keine Daten verfügbar." + +msgid "-12 Hours" +msgstr "" + +msgid "+12 Hours" +msgstr "" + +msgid "Switch" +msgstr "" + +msgid "Screenshot" +msgstr "" + +msgid "Once" +msgstr "Sobald" + +msgid "Every" +msgstr "Jeden" + +msgid "Mon-Fri" +msgstr "Mo-Fr" + +msgid "Sun-Sat" +msgstr "So-Sa" + +msgid "Start" +msgstr "Anfang" + +msgid "Stop" +msgstr "Halt" + +msgid "Frequency" +msgstr "Frequenz" + +msgid "24h" +msgstr "" + +msgid "12h" +msgstr "" + +msgid "Up" +msgstr "" + +msgid "Down" +msgstr "" + +msgid "Manual" +msgstr "" + +msgid "Manual in EPG" +msgstr "" + +msgid "Automatic in EPG" +msgstr "" + +msgid "Hide mainmenu entry" +msgstr "Hauptmenüeintrag verstecken" + +msgid "Replace original schedule" +msgstr "" + +msgid "Channel Change" +msgstr "" + +msgid "Time format" +msgstr "Zeit-Format" + +msgid "Channel Order" +msgstr "" + +msgid "Yet another EPG in HD" +msgstr "" + +msgid "YaepgHD" +msgstr "" diff --git a/po/fi_FI.po b/po/fi_FI.po new file mode 100644 index 0000000..6ed9ff1 --- /dev/null +++ b/po/fi_FI.po @@ -0,0 +1,94 @@ +# VDR plugin language source file. +# Copyright (C) 2009 bball <bball950@yahoo.com> +# This file is distributed under the same license as the yaepghd package. +# Rolf Ahrenberg <rahrenbe@cc.hut.fi>, 2009 +# +msgid "" +msgstr "" +"Project-Id-Version: Yaepghd 0.0.1\n" +"Report-Msgid-Bugs-To: <see README>\n" +"POT-Creation-Date: 2009-01-28 20:31+0200\n" +"PO-Revision-Date: 2009-01-28 10:51+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=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "No Info" +msgstr "Ei tietoja" + +msgid "-12 Hours" +msgstr "-12h" + +msgid "+12 Hours" +msgstr "+12h" + +msgid "Switch" +msgstr "Vaihda" + +msgid "Screenshot" +msgstr "Kuvakaappaus" + +msgid "Once" +msgstr "kerran" + +msgid "Every" +msgstr "aina" + +msgid "Mon-Fri" +msgstr "Ma-pe" + +msgid "Sun-Sat" +msgstr "Su-la" + +msgid "Start" +msgstr "Aloitus" + +msgid "Stop" +msgstr "Lopetus" + +msgid "Frequency" +msgstr "Taajuus" + +msgid "24h" +msgstr "24h" + +msgid "12h" +msgstr "12h" + +msgid "Up" +msgstr "nouseva" + +msgid "Down" +msgstr "laskeva" + +msgid "Manual" +msgstr "manuaalinen" + +msgid "Manual in EPG" +msgstr "manuaalinen; EPG" + +msgid "Automatic in EPG" +msgstr "automaattinen; EPG" + +msgid "Hide mainmenu entry" +msgstr "Piilota valinta päävalikosta" + +msgid "Replace original schedule" +msgstr "Korvaa alkuperäinen ohjelmaopas" + +msgid "Channel Change" +msgstr "Kanavanvaihto" + +msgid "Time format" +msgstr "Kellonajan esitysmuoto" + +msgid "Channel Order" +msgstr "Kanavajärjetys" + +msgid "Yet another EPG in HD" +msgstr "Vaihtoehtoinen ohjelmaopas" + +msgid "YaepgHD" +msgstr "Ohjelmaopas (YaepgHD)" @@ -12,17 +12,30 @@ #include <string> #include <vector> #include <map> +#include <assert.h> +#include <Magick++.h> +#ifdef YAEPGHD_REEL_EHD +#include <curl/curl.h> +#endif + +#include <vdr/config.h> +#include <vdr/tools.h> #include <vdr/plugin.h> #include <vdr/osd.h> #include <vdr/device.h> -#include <Magick++.h> -#include <curl/curl.h> -#include <assert.h> +#include <vdr/thread.h> + +#ifndef YAEPGHDVERSNUM +#error "You must apply the yaepghd patch for VDR!" +#endif + +#if defined(APIVERSNUM) && APIVERSNUM < 10600 +#error "VDR-1.6.0 API version or greater is required!" +#endif /** * Macros */ -// #define REEL_EHD #ifdef DEBUG #define ASSERT assert @@ -110,42 +123,40 @@ #define MSG_BOX_GEOM THEME_GEOM("msgBoxGeom") /* Manner in which channel is changed while in YAEPG */ -#define CHANNEL_CHANGE_MANUAL 0 -#define CHANNEL_CHANGE_MANUAL_INEPG 1 -#define CHANNEL_CHANGE_AUTO_INEPG 2 +enum eChanneChangeType { + CHANNEL_CHANGE_MANUAL, + CHANNEL_CHANGE_MANUAL_INEPG, + CHANNEL_CHANGE_AUTO_INEPG, + CHANNEL_CHANGE_COUNT +}; + +enum eTimeFormatType { + TIME_FORMAT_24H, + TIME_FORMAT_12H, + TIME_FORMAT_COUNT +}; -#define TIME_24HR 0 -#define TIME_12HR 1 #define FMT_AMPM(_hr) ((_hr) >= 12 ? "p" : "a") #define FMT_12HR(_hr) ((_hr) % 12 == 0 ? 12 : (_hr) % 12) /* Order of channels (UP or DOWN) */ -#define CHANNEL_ORDER_UP 0 -#define CHANNEL_ORDER_DOWN 1 +enum eChannelOrderType { + CHANNEL_ORDER_UP, + CHANNEL_ORDER_DOWN, + CHANNEL_ORDER_COUNT +}; using namespace Magick; /** * Private Data */ -static const char *numToDay[7] = { - "Sun", - "Mon", - "Tue", - "Wed", - "Thur", - "Fri", - "Sat" -}; - static int iHideMenuEntry = false; +static int iReplaceOrgSchedule = false; static int iChannelChange = CHANNEL_CHANGE_MANUAL; -static int iTimeFormat = TIME_12HR; +static int iTimeFormat = TIME_FORMAT_12H; static int iChannelOrder = CHANNEL_ORDER_DOWN; -static char *sThemeName = "default"; -static const char *TIME_FORMATS[2] = { "24", "12" }; -static const char *CH_ORDER_FORMATS[2] = { "UP", "DOWN" }; -static const char *CH_CHANGE_MODES[3] = { "MANUAL", "MANUAL IN EPG", "AUTO IN EPG" }; +static char sThemeName[MaxThemeName] = "default"; /** * Pirvate Classes/Function Prototypes @@ -172,7 +183,7 @@ yaepg_error(const char *func, const char *fmt, ...) vsnprintf(eMsg, sizeof(eMsg), fmt, ap); va_end(ap); snprintf(eLine, sizeof(eLine), "ERROR: YaEPGHD: %s: %s", func, eMsg); - esyslog(eLine); + esyslog("%s", eLine); } void @@ -185,7 +196,7 @@ yaepg_info(const char *func, const char *fmt, ...) vsnprintf(iMsg, sizeof(iMsg), fmt, ap); va_end(ap); snprintf(iLine, sizeof(iLine), "INFO: YaEPGHD: %s: %s", func, iMsg); - isyslog(iLine); + isyslog("%s", iLine); } /* @@ -958,8 +969,8 @@ cYaepgGrid::cNoInfoEvent::cNoInfoEvent(time_t startTime) : { SetStartTime(startTime); SetDuration(9000); - SetTitle(tr(tr("No Info"))); - SetDescription(tr(tr("No Info"))); + SetTitle(tr("No Info")); + SetDescription(tr("No Info")); } cYaepgGrid::cYaepgGrid(std::vector< cChannel *> &chans, int time) : @@ -1385,7 +1396,7 @@ cYaepgGridTime::Generate(void) for (int i = 0; i < 3; i++) { localtime_r(&curTime, &locTime); locTime.tm_min = (locTime.tm_min >= 30) ? 30 : 0; - if (iTimeFormat == TIME_24HR) { + if (iTimeFormat == TIME_FORMAT_24H) { snprintf(timeStr, sizeof(timeStr), "%02d:%02d", locTime.tm_hour, locTime.tm_min); } else { @@ -1453,7 +1464,7 @@ cYaepgGridDate::UpdateTime(time_t _t) t = _t; localtime_r(&t, &locTime); snprintf(dateStr, sizeof(dateStr), "%s %d/%d", - tr(numToDay[locTime.tm_wday]), locTime.tm_mon, locTime.tm_mday); + *WeekDayName((locTime.tm_wday + 6) % 6), locTime.tm_mon, locTime.tm_mday); Generate(); } @@ -1575,7 +1586,7 @@ cYaepgEventTime::Generate(void) localtime_r(&t, &locStart); t += event->Duration(); localtime_r(&t, &locEnd); - if (iTimeFormat == TIME_24HR) { + if (iTimeFormat == TIME_FORMAT_24H) { snprintf(timeStr, sizeof(timeStr), "%02d:%02d - %02d:%02d", locStart.tm_hour, locStart.tm_min, locEnd.tm_hour, locEnd.tm_min); @@ -1635,7 +1646,7 @@ cYaepgEventDesc::cYaepgEventDesc(const cEvent *_event) : void cYaepgEventDesc::Generate(void) { - box.Text(event->Description() ? event->Description() : ""); + box.Text(event->Description() ? event->Description() : (event->ShortText() ? event->ShortText() : "")); box.Font(EVENT_DESC_FONT); box.FgColor(EVENT_DESC_COLOR); box.BgColor(clrTransparent); @@ -1686,12 +1697,12 @@ cYaepgEventDate::Generate(void) time_t t = time(NULL); localtime_r(&t, &locTime); - if (iTimeFormat == TIME_24HR) { + if (iTimeFormat == TIME_FORMAT_24H) { snprintf(timeStr, sizeof(timeStr), "%s %02d:%02d", - tr(numToDay[locTime.tm_wday]), locTime.tm_hour, locTime.tm_min); + *WeekDayName((locTime.tm_wday + 6) % 6), locTime.tm_hour, locTime.tm_min); } else { snprintf(timeStr, sizeof(timeStr), "%s %d:%02d%s", - tr(numToDay[locTime.tm_wday]), + *WeekDayName((locTime.tm_wday + 6) % 6), FMT_12HR(locTime.tm_hour), locTime.tm_min, FMT_AMPM(locTime.tm_hour)); } @@ -1810,10 +1821,10 @@ public: }; const char *cYaepgHelpBar::helpStrs[4] = { - "-12 Hours", - "+12 Hours", - "Tune Channel", - "Screenshot" + trNOOP("-12 Hours"), + trNOOP("+12 Hours"), + trNOOP("Switch"), + trNOOP("Screenshot") }; const tColor cYaepgHelpBar::dotColors[4] = { @@ -1829,7 +1840,7 @@ cYaepgHelpBar::cYaepgHelpBar(void) : geom = HELP_BAR_GEOM; int boxWidth = geom.w / 4; for (int i = 0; i < 4; i++) { - boxes[i].Text(helpStrs[i]); + boxes[i].Text(tr(helpStrs[i])); boxes[i].Font(GRID_EVENT_FONT); boxes[i].FgColor(GRID_EVENT_COLOR); boxes[i].BgColor(clrTransparent); @@ -1886,7 +1897,7 @@ cYaepgInputTime::UpdateTime(time_t _t) t = _t; localtime_r(&t, &locTime); - if (iTimeFormat == TIME_24HR) { + if (iTimeFormat == TIME_FORMAT_24H) { snprintf(timeStr, sizeof(timeStr), "%02d:%02d", locTime.tm_hour, locTime.tm_min); } else { @@ -2010,10 +2021,10 @@ public: }; const char *cYaepgRecDlg::freqStra[4] = { - "Once", - "Every", - "Mon-Fri", - "Sun-Sat", + trNOOP("Once"), + trNOOP("Every"), + trNOOP("Mon-Fri"), + trNOOP("Sun-Sat"), }; cYaepgRecDlg::cYaepgRecDlg(void) : @@ -2107,9 +2118,8 @@ cYaepgRecDlg::cYaepgRecDlg(void) : freqInput.H(REC_FRINP_GEOM.h); for (int i = 0; i < 4; i++) { - strcpy(freqs[i], tr(freqStra[i])); + strncpy(freqs[i], tr(freqStra[i]), sizeof(freqs[i])); } - freqs[5][0] = '\0'; } eOSState @@ -2167,7 +2177,7 @@ cYaepgRecDlg::UpdateEvent(const cEvent *_event) localtime_r(&t, &locStart); t += event->Duration(); localtime_r(&t, &locEnd); - if (iTimeFormat == TIME_24HR) { + if (iTimeFormat == TIME_FORMAT_24H) { snprintf(timeStr, sizeof(timeStr), "%02d:%02d - %02d:%02d", locStart.tm_hour, locStart.tm_min, locEnd.tm_hour, locEnd.tm_min); @@ -2190,7 +2200,7 @@ cYaepgRecDlg::UpdateEvent(const cEvent *_event) t = event->StartTime(); localtime_r(&t, &locTime); freqs[1][5] = ' '; - strcpy(&freqs[1][6], tr(numToDay[locTime.tm_wday])); + strcpy(&freqs[1][6], *WeekDayName((locTime.tm_wday + 6) % 6)); freqInput.UpdateStra((char **)freqs); } @@ -2253,7 +2263,7 @@ cYaepgMsg::Draw(cBitmap *bmp) msgBox.Draw(bmp); } -#ifdef REEL_EHD +#ifdef YAEPGHD_REEL_EHD /* ***************************************************************************** * cReelVidWin @@ -2269,15 +2279,16 @@ cYaepgMsg::Draw(cBitmap *bmp) #define VIDPLANE_HORI 1920 #define VIDPLANE_VERT 1080 -class cReelVidWin { +class cReelVidWin : private cThread { private: - pthread_t thrd; FILE *readFp, *writeFp; - static void *CurlThread(void *arg); static size_t CurlWrite(void *ptr, size_t size, size_t nmemb, void *stream); void SendCmd(const char *cmd); +protected: + virtual void Action(void); + public: cReelVidWin(void); ~cReelVidWin(); @@ -2297,7 +2308,8 @@ cReelVidWin::~cReelVidWin() { Close(); SendCmd("exit\n"); - (void) pthread_join(thrd, NULL); + if (Running()) + Cancel(3); (void) close(fileno(readFp)); (void) close(fileno(writeFp)); (void) fclose(readFp); @@ -2310,30 +2322,29 @@ cReelVidWin::CurlWrite(void *ptr, size_t size, size_t nmemb, void *stream) return (size * nmemb); } -void * -cReelVidWin::CurlThread(void *arg) + +void cReelVidWin::Action(void) { CURL *hdl; CURLcode status; - FILE *fp = (FILE *)arg; hdl = curl_easy_init(); if (hdl == NULL) { YAEPG_ERROR("curl_easy_init"); - return NULL; + return; } status = curl_easy_setopt(hdl, CURLOPT_URL, "telnet://192.168.99.129/"); if (status != CURLE_OK) { YAEPG_ERROR("curl_easy_setopt"); - return NULL; + return; } /* Set the read FILE * to the read end of the pipe */ - status = curl_easy_setopt(hdl, CURLOPT_READDATA, fp); + status = curl_easy_setopt(hdl, CURLOPT_READDATA, readFp); if (status != CURLE_OK) { YAEPG_ERROR("curl_easy_setopt"); - return NULL; + return; } /* Setup our own write function so we can discard output */ @@ -2341,18 +2352,18 @@ cReelVidWin::CurlThread(void *arg) (curl_write_callback)&CurlWrite); if (status != CURLE_OK) { YAEPG_ERROR("curl_easy_setopt"); - return NULL; + return; } /* Connect to eHD card, this call blocks until the connection is closed */ status = curl_easy_perform(hdl); if (status != CURLE_OK) { YAEPG_ERROR("curl_easy_perform"); - return NULL; + return; } YAEPG_INFO("Thread exit!"); - return NULL; + return; } void @@ -2370,7 +2381,7 @@ cReelVidWin::SendCmd(const char *cmd) bool cReelVidWin::Init(void) { - int pfds[2], error; + int pfds[2]; char errStr[128]; /* Init the curl library */ @@ -2402,13 +2413,8 @@ cReelVidWin::Init(void) return false; } - /* Create a thread to handle the telnet connection */ - error = pthread_create(&thrd, NULL, (void *(*)(void *))&CurlThread, readFp); - if (error) { - snprintf(errStr, sizeof(errStr), "pthread_create: %s", strerror(error)); - YAEPG_ERROR(errStr); - return false; - } + /* Start a thread to handle the telnet connection */ + Start(); return true; } @@ -2540,7 +2546,7 @@ cYaepghd::~cYaepghd() delete eventDesc; delete eventDate; delete helpBar; -#ifdef REEL_EHD +#ifdef YAEPGHD_REEL_EHD reelVidWin->Close(); #endif } @@ -2583,7 +2589,7 @@ cYaepghd::Show(void) osd->vidWin.bpp = 12; } -#ifdef REEL_EHD +#ifdef YAEPGHD_REEL_EHD reelVidWin->Open(VID_WIN_GEOM); #endif @@ -2852,9 +2858,9 @@ cYaepghd::SwitchToCurrentChannel(bool closeVidWin) * plane is sacled down. To get around this problem we close/reopen the * video window across channel changes. */ -#ifdef REEL_EHD +#ifdef YAEPGHD_REEL_EHD reelVidWin->Close(); - usleep(100000); /* 1/10 of a second */ + cCondWait::SleepMs(100); #endif ret = cDevice::PrimaryDevice()->SetChannel(gridChan, true); @@ -2862,7 +2868,7 @@ cYaepghd::SwitchToCurrentChannel(bool closeVidWin) fprintf(stderr, "SetChannel(): %d\n", ret); } -#ifdef REEL_EHD +#ifdef YAEPGHD_REEL_EHD if (closeVidWin == false) { reelVidWin->Open(VID_WIN_GEOM); } @@ -2927,11 +2933,15 @@ cYaepghd::Draw(void) class cMenuSetupYaepg : public cMenuSetupPage { private: int iNewHideMenuEntry; + int iNewReplaceOrgSchedule; int iNewChannelChange; int iNewTimeFormat; int iNewChannelOrder; int iNewThemeIndex; - + const char *TIME_FORMATS[TIME_FORMAT_COUNT]; + const char *CH_ORDER_FORMATS[CHANNEL_ORDER_COUNT]; + const char *CH_CHANGE_MODES[CHANNEL_CHANGE_COUNT]; + protected: virtual void Store(void); @@ -2939,14 +2949,17 @@ public: cMenuSetupYaepg(void); }; + void cMenuSetupYaepg::Store(void) { iHideMenuEntry = iNewHideMenuEntry; + iReplaceOrgSchedule = iNewReplaceOrgSchedule; iChannelChange = iNewChannelChange; iTimeFormat = iNewTimeFormat; iChannelOrder = iNewChannelOrder; SetupStore("HideMenuEntry", iHideMenuEntry); + SetupStore("ReplaceOrgSchedule", iReplaceOrgSchedule); SetupStore("ChannelChange", iChannelChange); SetupStore("TimeFormat", iTimeFormat); SetupStore("ChannelOrder", iChannelOrder); @@ -2958,6 +2971,16 @@ cMenuSetupYaepg::cMenuSetupYaepg(void) char **themes; int numThemes; + TIME_FORMATS[TIME_FORMAT_24H] = tr("24h"); + TIME_FORMATS[TIME_FORMAT_12H] = tr("12h"); + + CH_ORDER_FORMATS[CHANNEL_ORDER_UP] = tr("Up"); + CH_ORDER_FORMATS[CHANNEL_ORDER_DOWN] = tr("Down"); + + CH_CHANGE_MODES[CHANNEL_CHANGE_MANUAL] = tr("Manual"); + CH_CHANGE_MODES[CHANNEL_CHANGE_MANUAL_INEPG] = tr("Manual in EPG"); + CH_CHANGE_MODES[CHANNEL_CHANGE_AUTO_INEPG] = tr("Automatic in EPG"); + cYaepgTheme::Themes(&themes, &numThemes); iNewThemeIndex = 0; if (sThemeName) { @@ -2974,12 +2997,14 @@ cMenuSetupYaepg::cMenuSetupYaepg(void) iNewChannelChange = iChannelChange; iNewTimeFormat = iTimeFormat; iNewChannelOrder = iChannelOrder; + iNewReplaceOrgSchedule = iReplaceOrgSchedule; Add(new cMenuEditBoolItem (tr("Hide mainmenu entry"), &iNewHideMenuEntry)); - Add(new cMenuEditStraItem (tr("Channel Change"), &iNewChannelChange, 3, CH_CHANGE_MODES)); - Add(new cMenuEditStraItem (tr("Time format"), &iNewTimeFormat, 2, TIME_FORMATS)); - Add(new cMenuEditStraItem (tr("Channel Order"), &iNewChannelOrder, 2, CH_ORDER_FORMATS)); - Add(new cMenuEditStraItem (tr("Theme"), &iNewThemeIndex, numThemes, themes)); + Add(new cMenuEditBoolItem (tr("Replace original schedule"), &iNewReplaceOrgSchedule)); + Add(new cMenuEditStraItem (tr("Channel Change"), &iNewChannelChange, CHANNEL_CHANGE_COUNT, CH_CHANGE_MODES)); + Add(new cMenuEditStraItem (tr("Time format"), &iNewTimeFormat, TIME_FORMAT_COUNT, TIME_FORMATS)); + Add(new cMenuEditStraItem (tr("Channel Order"), &iNewChannelOrder, CHANNEL_ORDER_COUNT, CH_ORDER_FORMATS)); + Add(new cMenuEditStraItem (trVDR("Setup.OSD$Theme"), &iNewThemeIndex, numThemes, themes)); for (int i = 0; i < numThemes; i++) { free(themes[i]); @@ -2993,8 +3018,8 @@ cMenuSetupYaepg::cMenuSetupYaepg(void) ***************************************************************************** */ static const char *VERSION = "0.0.1"; -static const char *DESCRIPTION = "HD version of yaepg"; -static const char *MAINMENUENTRY = "Yaepghd"; +static const char *DESCRIPTION = trNOOP("Yet another EPG in HD"); +static const char *MAINMENUENTRY = trNOOP("YaepgHD"); class cPluginYaepghd : public cPlugin { private: @@ -3004,7 +3029,7 @@ public: cPluginYaepghd(void); virtual ~cPluginYaepghd(); virtual const char *Version(void) { return VERSION; } - virtual const char *Description(void) { return DESCRIPTION; } + virtual const char *Description(void) { return tr(DESCRIPTION); } virtual const char *CommandLineHelp(void); virtual bool ProcessArgs(int argc, char *argv[]); virtual bool Initialize(void); @@ -3014,7 +3039,7 @@ public: virtual void MainThreadHook(void); virtual cString Active(void); virtual time_t WakeupTime(void); - virtual const char *MainMenuEntry(void) { return MAINMENUENTRY; } + virtual const char *MainMenuEntry(void) { return tr(MAINMENUENTRY); } virtual cOsdObject *MainMenuAction(void); virtual cMenuSetupPage *SetupMenu(void); virtual bool SetupParse(const char *Name, const char *Value); @@ -3060,7 +3085,7 @@ bool cPluginYaepghd::Start(void) { // Start any background activities the plugin shall perform. -#ifdef REEL_EHD +#ifdef YAEPGHD_REEL_EHD reelVidWin = new cReelVidWin; reelVidWin->Init(); #endif @@ -3071,7 +3096,7 @@ void cPluginYaepghd::Stop(void) { // Stop any background activities the plugin is performing. -#ifdef REEL_EHD +#ifdef YAEPGHD_REEL_EHD delete reelVidWin; #endif } @@ -3134,7 +3159,18 @@ cPluginYaepghd::SetupParse(const char *Name, const char *Value) bool cPluginYaepghd::Service(const char *Id, void *Data) { - // Handle custom service requests from other plugins + if (strcmp(Id, "MainMenuHooksPatch-v1.0::osSchedule") == 0 && iReplaceOrgSchedule) + { + if (!Data) { + return true; + } + cOsdMenu **menu = (cOsdMenu**)Data; + if (menu) { + *menu = (cOsdMenu*)MainMenuAction(); + } + return true; + } + return false; } |
