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

Changed the 'languageCode' members in the descriptor classes of 'libsi' to 'char[4]' and setting the 4th byte to 0 for easier handling

This commit is contained in:
Klaus Schmidinger 2004-01-24 14:59:04 +01:00
parent 72189b5228
commit 12fd3cdeb4
5 changed files with 25 additions and 18 deletions

View File

@ -2615,3 +2615,5 @@ Video Disk Recorder Revision History
- Completed the Finnish OSD texts (thanks to Rolf Ahrenberg). - Completed the Finnish OSD texts (thanks to Rolf Ahrenberg).
- Added ISO639LanguageDescriptor to 'libsi'. - Added ISO639LanguageDescriptor to 'libsi'.
- Changed the 'languageCode' members in the descriptor classes of 'libsi' to
'char[4]' and setting the 4th byte to 0 for easier handling.

11
i18n.c
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: i18n.c 1.144 2004/01/24 10:02:37 kls Exp $ * $Id: i18n.c 1.145 2004/01/24 14:58:08 kls Exp $
* *
* Translations provided by: * Translations provided by:
* *
@ -4238,16 +4238,13 @@ const char * I18nLanguageAbbreviation(int Index)
return Index < I18nNumLanguages ? Phrases[2][Index] : NULL; return Index < I18nNumLanguages ? Phrases[2][Index] : NULL;
} }
int I18nLanguageIndex(const char Code[3]) int I18nLanguageIndex(const char *Code)
{ {
char s[4];
memcpy(s, Code, 3);
s[3] = 0;
for (int i = 0; i < I18nNumLanguages; i++) { for (int i = 0; i < I18nNumLanguages; i++) {
if (strcasestr(Phrases[2][i], s)) if (strcasestr(Phrases[2][i], Code))
return i; return i;
} }
//dsyslog("unknown language code: '%s'", s); //dsyslog("unknown language code: '%s'", Code);
return -1; return -1;
} }

4
i18n.h
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: i18n.h 1.9 2004/01/16 12:43:47 kls Exp $ * $Id: i18n.h 1.10 2004/01/24 14:57:29 kls Exp $
*/ */
#ifndef __I18N_H #ifndef __I18N_H
@ -23,7 +23,7 @@ const char *I18nTranslate(const char *s, const char *Plugin = NULL);
const char * const * I18nLanguages(void); const char * const * I18nLanguages(void);
const char * const * I18nCharSets(void); const char * const * I18nCharSets(void);
const char * I18nLanguageAbbreviation(int Index); const char * I18nLanguageAbbreviation(int Index);
int I18nLanguageIndex(const char Code[3]); int I18nLanguageIndex(const char *Code);
bool I18nIsPreferredLanguage(int *PreferredLanguages, int LanguageIndex, int &OldPreference); bool I18nIsPreferredLanguage(int *PreferredLanguages, int LanguageIndex, int &OldPreference);
#ifdef PLUGIN_NAME_I18N #ifdef PLUGIN_NAME_I18N

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: descriptor.c 1.4 2004/01/24 14:49:00 kls Exp $ * $Id: descriptor.c 1.5 2004/01/24 14:52:41 kls Exp $
* * * *
***************************************************************************/ ***************************************************************************/
@ -22,6 +22,7 @@ void ShortEventDescriptor::Parse() {
languageCode[0]=s->lang_code1; languageCode[0]=s->lang_code1;
languageCode[1]=s->lang_code2; languageCode[1]=s->lang_code2;
languageCode[2]=s->lang_code3; languageCode[2]=s->lang_code3;
languageCode[3]=0;
name.setDataAndOffset(data+offset, s->event_name_length, offset); name.setDataAndOffset(data+offset, s->event_name_length, offset);
const descr_short_event_mid *mid; const descr_short_event_mid *mid;
data.setPointerAndOffset<const descr_short_event_mid>(mid, offset); data.setPointerAndOffset<const descr_short_event_mid>(mid, offset);
@ -42,6 +43,7 @@ void ExtendedEventDescriptor::Parse() {
languageCode[0]=s->lang_code1; languageCode[0]=s->lang_code1;
languageCode[1]=s->lang_code2; languageCode[1]=s->lang_code2;
languageCode[2]=s->lang_code3; languageCode[2]=s->lang_code3;
languageCode[3]=0;
itemLoop.setDataAndOffset(data+offset, s->length_of_items, offset); itemLoop.setDataAndOffset(data+offset, s->length_of_items, offset);
const descr_extended_event_mid *mid; const descr_extended_event_mid *mid;
data.setPointerAndOffset<const descr_extended_event_mid>(mid, offset); data.setPointerAndOffset<const descr_extended_event_mid>(mid, offset);
@ -183,6 +185,7 @@ void ParentalRatingDescriptor::Rating::Parse() {
languageCode[0]=s->lang_code1; languageCode[0]=s->lang_code1;
languageCode[1]=s->lang_code2; languageCode[1]=s->lang_code2;
languageCode[2]=s->lang_code3; languageCode[2]=s->lang_code3;
languageCode[3]=0;
} }
int CaDescriptor::getCaType() const { int CaDescriptor::getCaType() const {
@ -398,6 +401,7 @@ void ComponentDescriptor::Parse() {
languageCode[0]=s->lang_code1; languageCode[0]=s->lang_code1;
languageCode[1]=s->lang_code2; languageCode[1]=s->lang_code2;
languageCode[2]=s->lang_code3; languageCode[2]=s->lang_code3;
languageCode[3]=0;
description.setData(data+offset, getLength()-offset); description.setData(data+offset, getLength()-offset);
} }
@ -462,6 +466,7 @@ void MultilingualNameDescriptor::Name::Parse() {
languageCode[0]=s->lang_code1; languageCode[0]=s->lang_code1;
languageCode[1]=s->lang_code2; languageCode[1]=s->lang_code2;
languageCode[2]=s->lang_code3; languageCode[2]=s->lang_code3;
languageCode[3]=0;
name.setData(data+offset, s->text_length); name.setData(data+offset, s->text_length);
} }
@ -486,6 +491,7 @@ void MultilingualServiceNameDescriptor::Name::Parse() {
languageCode[0]=s->lang_code1; languageCode[0]=s->lang_code1;
languageCode[1]=s->lang_code2; languageCode[1]=s->lang_code2;
languageCode[2]=s->lang_code3; languageCode[2]=s->lang_code3;
languageCode[3]=0;
providerName.setDataAndOffset(data+offset, s->text_length, offset); providerName.setDataAndOffset(data+offset, s->text_length, offset);
const entry_multilingual_service_name_mid *mid; const entry_multilingual_service_name_mid *mid;
data.setPointerAndOffset<const entry_multilingual_service_name_mid>(mid, offset); data.setPointerAndOffset<const entry_multilingual_service_name_mid>(mid, offset);
@ -520,6 +526,7 @@ void ISO639LanguageDescriptor::Parse() {
languageCode[0]=s->lang_code1; languageCode[0]=s->lang_code1;
languageCode[1]=s->lang_code2; languageCode[1]=s->lang_code2;
languageCode[2]=s->lang_code3; languageCode[2]=s->lang_code3;
languageCode[3]=0;
} }
void ApplicationSignallingDescriptor::Parse() { void ApplicationSignallingDescriptor::Parse() {
@ -590,6 +597,7 @@ void MHP_ApplicationNameDescriptor::NameEntry::Parse() {
languageCode[0]=s->lang_code1; languageCode[0]=s->lang_code1;
languageCode[1]=s->lang_code2; languageCode[1]=s->lang_code2;
languageCode[2]=s->lang_code3; languageCode[2]=s->lang_code3;
languageCode[3]=0;
} }
int MHP_TransportProtocolDescriptor::getProtocolId() const { int MHP_TransportProtocolDescriptor::getProtocolId() const {

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: descriptor.h 1.4 2004/01/24 14:49:00 kls Exp $ * $Id: descriptor.h 1.5 2004/01/24 14:52:05 kls Exp $
* * * *
***************************************************************************/ ***************************************************************************/
@ -20,7 +20,7 @@ namespace SI {
class ShortEventDescriptor : public Descriptor { class ShortEventDescriptor : public Descriptor {
public: public:
char languageCode[3]; char languageCode[4];
String name; //name of the event String name; //name of the event
String text; //short description String text; //short description
protected: protected:
@ -37,7 +37,7 @@ public:
protected: protected:
virtual void Parse(); virtual void Parse();
}; };
char languageCode[3]; char languageCode[4];
int getDescriptorNumber(); int getDescriptorNumber();
int getLastDescriptorNumber(); int getLastDescriptorNumber();
StructureLoop<Item> itemLoop; StructureLoop<Item> itemLoop;
@ -93,7 +93,7 @@ class ParentalRatingDescriptor : public Descriptor {
public: public:
class Rating : public LoopElement { class Rating : public LoopElement {
public: public:
char languageCode[3]; char languageCode[4];
int getRating() const; int getRating() const;
virtual int getLength() { return sizeof(parental_rating); } virtual int getLength() { return sizeof(parental_rating); }
protected: protected:
@ -258,7 +258,7 @@ public:
int getStreamContent() const; int getStreamContent() const;
int getComponentType() const; int getComponentType() const;
int getComponentTag() const; int getComponentTag() const;
char languageCode[3]; char languageCode[4];
String description; String description;
protected: protected:
virtual void Parse(); virtual void Parse();
@ -317,7 +317,7 @@ class MultilingualNameDescriptor : public Descriptor {
public: public:
class Name : public LoopElement { class Name : public LoopElement {
public: public:
char languageCode[3]; char languageCode[4];
String name; String name;
virtual int getLength() { return sizeof(entry_multilingual_name)+name.getLength(); } virtual int getLength() { return sizeof(entry_multilingual_name)+name.getLength(); }
protected: protected:
@ -376,7 +376,7 @@ private:
class ISO639LanguageDescriptor : public Descriptor { class ISO639LanguageDescriptor : public Descriptor {
public: public:
char languageCode[3]; char languageCode[4];
protected: protected:
virtual void Parse(); virtual void Parse();
private: private:
@ -436,7 +436,7 @@ public:
class NameEntry : public LoopElement { class NameEntry : public LoopElement {
public: public:
virtual int getLength() { return sizeof(descr_application_name_entry)+name.getLength(); } virtual int getLength() { return sizeof(descr_application_name_entry)+name.getLength(); }
char languageCode[3]; char languageCode[4];
String name; String name;
protected: protected:
virtual void Parse(); virtual void Parse();