1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

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 reporting a possible crash in the OSD demo
for adding support for systemd
for suggesting to replace VDR_CHARSET_OVERRIDE with a command line option
Stefan Huskamp <coca_cola1@gmx.de>
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
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.
- 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
other encodings, but fail to correctly announce that.
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.
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
placed at exactly the same offset in a recording are now preserved in the cutting
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
* 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
@ -22,13 +22,13 @@
// VDR's own version number:
#define VDRVERSION "2.1.9"
#define VDRVERSNUM 20109 // Version * 10000 + Major * 100 + Minor
#define VDRVERSION "2.1.10"
#define VDRVERSNUM 20110 // Version * 10000 + Major * 100 + Minor
// The plugin API's version number:
#define APIVERSION "2.1.9"
#define APIVERSNUM 20109 // Version * 10000 + Major * 100 + Minor
#define APIVERSION "2.1.10"
#define APIVERSNUM 20110 // Version * 10000 + Major * 100 + Minor
// When loading plugins, VDR searches them by their APIVERSION, which
// 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 *
* (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;
}
static char *OverrideCharacterTable = NULL;
void SetOverrideCharacterTable(const char *CharacterTable)
{
free(OverrideCharacterTable);
OverrideCharacterTable = CharacterTable ? strdup(CharacterTable) : NULL;
}
bool SetSystemCharacterTable(const char *CharacterTable) {
if (CharacterTable) {
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
// "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.
static const char *CharsetOverride = getenv("VDR_CHARSET_OVERRIDE");
if (CharsetOverride)
cs = CharsetOverride;
if (OverrideCharacterTable)
cs = OverrideCharacterTable;
if (isSingleByte)
*isSingleByte = false;
if (length <= 0)

View File

@ -6,7 +6,7 @@
* the Free Software Foundation; either version 2 of the License, or *
* (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);
};
// 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
// like "iso8859-15" or "utf-8" (case insensitive).
// 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
.\" 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"
.SH NAME
@ -49,6 +49,11 @@ Send Dolby Digital audio to stdin of command \fIcmd\fR.
Save cache files in \fIdir\fR
(default is to save them in the video directory).
.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
Read config files from directory \fIdir\fR
(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
*
* $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>
@ -216,6 +216,12 @@ int main(int argc, char *argv[])
bool MuteAudio = false;
int WatchdogTimeout = DEFAULTWATCHDOG;
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;
const char *LircDevice = NULL;
@ -244,6 +250,7 @@ int main(int argc, char *argv[])
static struct option long_options[] = {
{ "audio", required_argument, NULL, 'a' },
{ "cachedir", required_argument, NULL, 'c' | 0x100 },
{ "chartab", required_argument, NULL, 'c' | 0x200 },
{ "config", required_argument, NULL, 'c' },
{ "daemon", no_argument, NULL, 'd' },
{ "device", required_argument, NULL, 'D' },
@ -287,6 +294,9 @@ int main(int argc, char *argv[])
case 'c' | 0x100:
CacheDirectory = optarg;
break;
case 'c' | 0x200:
OverrideCharacterTable = optarg;
break;
case 'c': ConfigDirectory = optarg;
break;
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|
" -a CMD, --audio=CMD send Dolby Digital audio to stdin of command CMD\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"
" -d, --daemon run in daemon mode\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");
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: