Added command line option --chartab to replace VDR_CHARSET_OVERRIDE

This commit is contained in:
Klaus Schmidinger 2015-02-10 14:29:27 +01:00
parent d34abd6665
commit 89f5244007
9 changed files with 64 additions and 13 deletions

View File

@ -2962,6 +2962,7 @@ Christopher Reimer <vdr@creimer.net>
for reverting the change from version 1.5.7 that made all logging go to LOG_ERR for reverting the change from version 1.5.7 that made all logging go to LOG_ERR
for reporting a possible crash in the OSD demo for reporting a possible crash in the OSD demo
for adding support for systemd for adding support for systemd
for suggesting to replace VDR_CHARSET_OVERRIDE with a command line option
Stefan Huskamp <coca_cola1@gmx.de> Stefan Huskamp <coca_cola1@gmx.de>
for suggesting to make entering characters via the number keys for suggesting to make entering characters via the number keys

View File

@ -8545,3 +8545,9 @@ Video Disk Recorder Revision History
- The new option "Setup/Replay/Use Prev/Next keys for adaptive skipping" can be used - The new option "Setup/Replay/Use Prev/Next keys for adaptive skipping" can be used
to change the behavior of these keys during replay. They normally jump between to change the behavior of these keys during replay. They normally jump between
editing marks, but with this option set to 'yes' they will do adaptive skipping. editing marks, but with this option set to 'yes' they will do adaptive skipping.
- The new command line option --chartab can be used to set the default character
table to use for strings in the DVB data stream that don't begin with a proper
character table indicator (suggested by Christopher Reimer). The old mechanism
of using the environment variable VDR_CHARSET_OVERRIDE still works, but is now
deprecated and may be removed in a future version. The value given in the --chartab
option takes precedence over that in VDR_CHARSET_OVERRIDE.

View File

@ -141,7 +141,7 @@ According to "ETSI EN 300 468" the default character set fo SI data is
ISO6937. But unfortunately some broadcasters actually use ISO-8859-9 or ISO6937. But unfortunately some broadcasters actually use ISO-8859-9 or
other encodings, but fail to correctly announce that. other encodings, but fail to correctly announce that.
Users who want to set the default character set to something different can Users who want to set the default character set to something different can
do this by setting the environment variable VDR_CHARSET_OVERRIDE to something do this by using the command line option --chartab with something
like ISO-8859-9. like ISO-8859-9.
Start script with automatic restart in case of hangups: Start script with automatic restart in case of hangups:

View File

@ -393,3 +393,9 @@ Misc:
functions is now exacly as described in the header file. Editing marks that are functions is now exacly as described in the header file. Editing marks that are
placed at exactly the same offset in a recording are now preserved in the cutting placed at exactly the same offset in a recording are now preserved in the cutting
process. process.
- The new command line option --chartab can be used to set the default character
table to use for strings in the DVB data stream that don't begin with a proper
character table indicator. The old mechanism of using the environment variable
VDR_CHARSET_OVERRIDE still works, but is now deprecated and may be removed in a
future version. The value given in the --chartab option takes precedence over
that in VDR_CHARSET_OVERRIDE.

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: config.h 3.19 2015/02/10 12:23:10 kls Exp $ * $Id: config.h 3.20 2015/02/10 14:29:27 kls Exp $
*/ */
#ifndef __CONFIG_H #ifndef __CONFIG_H
@ -22,13 +22,13 @@
// VDR's own version number: // VDR's own version number:
#define VDRVERSION "2.1.9" #define VDRVERSION "2.1.10"
#define VDRVERSNUM 20109 // Version * 10000 + Major * 100 + Minor #define VDRVERSNUM 20110 // Version * 10000 + Major * 100 + Minor
// The plugin API's version number: // The plugin API's version number:
#define APIVERSION "2.1.9" #define APIVERSION "2.1.10"
#define APIVERSNUM 20109 // Version * 10000 + Major * 100 + Minor #define APIVERSNUM 20110 // Version * 10000 + Major * 100 + Minor
// When loading plugins, VDR searches them by their APIVERSION, which // When loading plugins, VDR searches them by their APIVERSION, which
// may be smaller than VDRVERSION in case there have been no changes to // may be smaller than VDRVERSION in case there have been no changes to

View File

@ -6,7 +6,7 @@
* the Free Software Foundation; either version 2 of the License, or * * the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. * * (at your option) any later version. *
* * * *
* $Id: si.c 3.2 2015/02/01 14:55:27 kls Exp $ * $Id: si.c 3.3 2015/02/10 13:42:41 kls Exp $
* * * *
***************************************************************************/ ***************************************************************************/
@ -319,6 +319,14 @@ bool systemCharacterTableIsSingleByte(void)
return SystemCharacterTableIsSingleByte; return SystemCharacterTableIsSingleByte;
} }
static char *OverrideCharacterTable = NULL;
void SetOverrideCharacterTable(const char *CharacterTable)
{
free(OverrideCharacterTable);
OverrideCharacterTable = CharacterTable ? strdup(CharacterTable) : NULL;
}
bool SetSystemCharacterTable(const char *CharacterTable) { bool SetSystemCharacterTable(const char *CharacterTable) {
if (CharacterTable) { if (CharacterTable) {
for (unsigned int i = 0; i < NumEntries(CharacterTables1); i++) { for (unsigned int i = 0; i < NumEntries(CharacterTables1); i++) {
@ -348,9 +356,8 @@ const char *getCharacterTable(const unsigned char *&buffer, int &length, bool *i
// Workaround for broadcaster stupidity: according to // Workaround for broadcaster stupidity: according to
// "ETSI EN 300 468" the default character set is ISO6937. But unfortunately some // "ETSI EN 300 468" the default character set is ISO6937. But unfortunately some
// broadcasters actually use ISO-8859-9, but fail to correctly announce that. // broadcasters actually use ISO-8859-9, but fail to correctly announce that.
static const char *CharsetOverride = getenv("VDR_CHARSET_OVERRIDE"); if (OverrideCharacterTable)
if (CharsetOverride) cs = OverrideCharacterTable;
cs = CharsetOverride;
if (isSingleByte) if (isSingleByte)
*isSingleByte = false; *isSingleByte = false;
if (length <= 0) if (length <= 0)

View File

@ -6,7 +6,7 @@
* the Free Software Foundation; either version 2 of the License, or * * the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. * * (at your option) any later version. *
* * * *
* $Id: si.h 3.3 2015/02/01 14:55:27 kls Exp $ * $Id: si.h 3.4 2015/02/10 13:54:28 kls Exp $
* * * *
***************************************************************************/ ***************************************************************************/
@ -522,6 +522,9 @@ protected:
void decodeText(char *buffer, char *shortVersion, int sizeBuffer, int sizeShortVersion); void decodeText(char *buffer, char *shortVersion, int sizeBuffer, int sizeShortVersion);
}; };
// Set the character table to use for strings that do not begin with a character
// table indicator. Call with NULL to turn this off.
void SetOverrideCharacterTable(const char *CharacterTable);
// Call this function to set the system character table. CharacterTable is a string // Call this function to set the system character table. CharacterTable is a string
// like "iso8859-15" or "utf-8" (case insensitive). // like "iso8859-15" or "utf-8" (case insensitive).
// Returns true if the character table was recognized. // Returns true if the character table was recognized.

7
vdr.1
View File

@ -8,7 +8,7 @@
.\" License as specified in the file COPYING that comes with the .\" License as specified in the file COPYING that comes with the
.\" vdr distribution. .\" vdr distribution.
.\" .\"
.\" $Id: vdr.1 3.4 2015/01/20 15:34:29 kls Exp $ .\" $Id: vdr.1 3.5 2015/02/10 13:59:11 kls Exp $
.\" .\"
.TH vdr 1 "31 Mar 2013" "2.0" "Video Disk Recorder" .TH vdr 1 "31 Mar 2013" "2.0" "Video Disk Recorder"
.SH NAME .SH NAME
@ -49,6 +49,11 @@ Send Dolby Digital audio to stdin of command \fIcmd\fR.
Save cache files in \fIdir\fR Save cache files in \fIdir\fR
(default is to save them in the video directory). (default is to save them in the video directory).
.TP .TP
.BI \-\-chartab= character_table
Set the character table to use for strings in the DVB data stream that don't begin
with a character table indicator, but don't use the standard default character table
(for instance ISO-8859-9).
.TP
.BI \-c\ dir ,\ \-\-config= dir .BI \-c\ dir ,\ \-\-config= dir
Read config files from directory \fIdir\fR Read config files from directory \fIdir\fR
(default is to read them from the video directory). (default is to read them from the video directory).

25
vdr.c
View File

@ -22,7 +22,7 @@
* *
* The project's page is at http://www.tvdr.de * The project's page is at http://www.tvdr.de
* *
* $Id: vdr.c 3.15 2015/01/17 14:48:09 kls Exp $ * $Id: vdr.c 3.16 2015/02/10 14:13:12 kls Exp $
*/ */
#include <getopt.h> #include <getopt.h>
@ -216,6 +216,12 @@ int main(int argc, char *argv[])
bool MuteAudio = false; bool MuteAudio = false;
int WatchdogTimeout = DEFAULTWATCHDOG; int WatchdogTimeout = DEFAULTWATCHDOG;
const char *Terminal = NULL; const char *Terminal = NULL;
const char *OverrideCharacterTable = NULL;
#define DEPRECATED_VDR_CHARSET_OVERRIDE
#ifdef DEPRECATED_VDR_CHARSET_OVERRIDE
OverrideCharacterTable = getenv("VDR_CHARSET_OVERRIDE");
const char *DeprecatedVdrCharsetOverride = OverrideCharacterTable;
#endif
bool UseKbd = true; bool UseKbd = true;
const char *LircDevice = NULL; const char *LircDevice = NULL;
@ -244,6 +250,7 @@ int main(int argc, char *argv[])
static struct option long_options[] = { static struct option long_options[] = {
{ "audio", required_argument, NULL, 'a' }, { "audio", required_argument, NULL, 'a' },
{ "cachedir", required_argument, NULL, 'c' | 0x100 }, { "cachedir", required_argument, NULL, 'c' | 0x100 },
{ "chartab", required_argument, NULL, 'c' | 0x200 },
{ "config", required_argument, NULL, 'c' }, { "config", required_argument, NULL, 'c' },
{ "daemon", no_argument, NULL, 'd' }, { "daemon", no_argument, NULL, 'd' },
{ "device", required_argument, NULL, 'D' }, { "device", required_argument, NULL, 'D' },
@ -287,6 +294,9 @@ int main(int argc, char *argv[])
case 'c' | 0x100: case 'c' | 0x100:
CacheDirectory = optarg; CacheDirectory = optarg;
break; break;
case 'c' | 0x200:
OverrideCharacterTable = optarg;
break;
case 'c': ConfigDirectory = optarg; case 'c': ConfigDirectory = optarg;
break; break;
case 'd': DaemonMode = true; case 'd': DaemonMode = true;
@ -517,6 +527,11 @@ int main(int argc, char *argv[])
printf("Usage: vdr [OPTIONS]\n\n" // for easier orientation, this is column 80| printf("Usage: vdr [OPTIONS]\n\n" // for easier orientation, this is column 80|
" -a CMD, --audio=CMD send Dolby Digital audio to stdin of command CMD\n" " -a CMD, --audio=CMD send Dolby Digital audio to stdin of command CMD\n"
" --cachedir=DIR save cache files in DIR (default: %s)\n" " --cachedir=DIR save cache files in DIR (default: %s)\n"
" --chartab=CHARACTER_TABLE\n"
" set the character table to use for strings in the\n"
" DVB data stream that don't begin with a character\n"
" table indicator, but don't use the standard default\n"
" character table (for instance ISO-8859-9)\n"
" -c DIR, --config=DIR read config files from DIR (default: %s)\n" " -c DIR, --config=DIR read config files from DIR (default: %s)\n"
" -d, --daemon run in daemon mode\n" " -d, --daemon run in daemon mode\n"
" -D NUM, --device=NUM use only the given DVB device (NUM = 0, 1, 2...)\n" " -D NUM, --device=NUM use only the given DVB device (NUM = 0, 1, 2...)\n"
@ -674,6 +689,14 @@ int main(int argc, char *argv[])
isyslog("codeset is '%s' - %s", CodeSet, known ? "known" : "unknown"); isyslog("codeset is '%s' - %s", CodeSet, known ? "known" : "unknown");
cCharSetConv::SetSystemCharacterTable(CodeSet); cCharSetConv::SetSystemCharacterTable(CodeSet);
} }
#ifdef DEPRECATED_VDR_CHARSET_OVERRIDE
if (DeprecatedVdrCharsetOverride)
isyslog("use of environment variable VDR_CHARSET_OVERRIDE (%s) is deprecated!", DeprecatedVdrCharsetOverride);
#endif
if (OverrideCharacterTable) {
isyslog("override character table is '%s'", OverrideCharacterTable);
SI::SetOverrideCharacterTable(OverrideCharacterTable);
}
// Initialize internationalization: // Initialize internationalization: