From 2f4526e55ec1bdf3ff0e2a71411cb2ae3bed6f5c Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 3 Sep 2005 15:19:00 +0200 Subject: [PATCH] Added support for multiple audio language codes in ISO639LanguageDescriptors to 'libsi' --- HISTORY | 2 ++ libsi/descriptor.c | 24 +++++++++++++++++++++--- libsi/descriptor.h | 15 +++++++++++++-- libsi/headers.h | 6 +++++- libsi/si.h | 8 +++++++- 5 files changed, 48 insertions(+), 7 deletions(-) diff --git a/HISTORY b/HISTORY index a9ced0a9..6b519207 100644 --- a/HISTORY +++ b/HISTORY @@ -3790,3 +3790,5 @@ Video Disk Recorder Revision History - Replaced the ':' delimiter between hour and minute in recording file names with a '.' under Linux, too. Existing recordings with ':' as delimiter will still work. - Implemented the SVDRP command MOVC (thanks to Andreas Brachold). +- Added support for multiple audio language codes in ISO639LanguageDescriptors to + 'libsi' (thanks to Marcel Wiesweg). diff --git a/libsi/descriptor.c b/libsi/descriptor.c index 207b7c25..cc3a0169 100644 --- a/libsi/descriptor.c +++ b/libsi/descriptor.c @@ -6,7 +6,7 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * - * $Id: descriptor.c 1.14 2004/10/16 09:51:05 kls Exp $ + * $Id: descriptor.c 1.15 2005/09/03 15:16:49 kls Exp $ * * ***************************************************************************/ @@ -655,14 +655,32 @@ LinkageType LinkageDescriptor::getLinkageType() const { } void ISO639LanguageDescriptor::Parse() { - unsigned int offset=0; - data.setPointerAndOffset(s, offset); + languageLoop.setData(data+sizeof(descr_iso_639_language), getLength()-sizeof(descr_iso_639_language)); + + //all this is for backwards compatibility only + Loop::Iterator it; + Language first; + if (languageLoop.getNext(first, it)) { + languageCode[0]=first.languageCode[0]; + languageCode[1]=first.languageCode[1]; + languageCode[2]=first.languageCode[2]; + languageCode[3]=0; + } else + languageCode[0]=0; +} + +void ISO639LanguageDescriptor::Language::Parse() { + s=data.getData(); languageCode[0]=s->lang_code1; languageCode[1]=s->lang_code2; languageCode[2]=s->lang_code3; languageCode[3]=0; } +AudioType ISO639LanguageDescriptor::Language::getAudioType() { + return (AudioType)s->audio_type; +} + void PDCDescriptor::Parse() { unsigned int offset=0; data.setPointerAndOffset(s, offset); diff --git a/libsi/descriptor.h b/libsi/descriptor.h index 73fd1059..476da3fb 100644 --- a/libsi/descriptor.h +++ b/libsi/descriptor.h @@ -6,7 +6,7 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * - * $Id: descriptor.h 1.12 2005/05/08 14:08:19 kls Exp $ + * $Id: descriptor.h 1.13 2005/09/03 15:17:35 kls Exp $ * * ***************************************************************************/ @@ -392,7 +392,18 @@ private: class ISO639LanguageDescriptor : public Descriptor { public: - char languageCode[4]; + char languageCode[4]; //for backwards compatibility + class Language : public LoopElement { + public: + virtual int getLength() { return sizeof(descr_iso_639_language_loop); } + char languageCode[4]; + AudioType getAudioType(); + protected: + virtual void Parse(); + private: + const descr_iso_639_language_loop *s; + }; + StructureLoop languageLoop; protected: virtual void Parse(); private: diff --git a/libsi/headers.h b/libsi/headers.h index ff3e0f95..69350cdd 100644 --- a/libsi/headers.h +++ b/libsi/headers.h @@ -10,7 +10,7 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * - * $Id: headers.h 1.4 2004/02/22 11:12:46 kls Exp $ + * $Id: headers.h 1.5 2005/09/03 15:18:16 kls Exp $ * * ***************************************************************************/ @@ -821,9 +821,13 @@ struct descr_ca { struct descr_iso_639_language { u_char descriptor_tag :8; u_char descriptor_length :8; +}; + +struct descr_iso_639_language_loop { u_char lang_code1 :8; u_char lang_code2 :8; u_char lang_code3 :8; + u_char audio_type :8; }; /* 0x13 carousel_identifier_descriptor */ diff --git a/libsi/si.h b/libsi/si.h index 8f89c343..3836b2fb 100644 --- a/libsi/si.h +++ b/libsi/si.h @@ -6,7 +6,7 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * - * $Id: si.h 1.11 2004/10/16 09:58:10 kls Exp $ + * $Id: si.h 1.12 2005/09/03 15:19:00 kls Exp $ * * ***************************************************************************/ @@ -166,6 +166,12 @@ enum LinkageType { LinkageTypeInformationService = 0x01, LinkageTypeTSContainingSsuBatOrNit = 0x0A }; +enum AudioType { AudioTypeUndefined = 0x00, + AudioTypeCleanEffects = 0x01, + AudioTypeHearingImpaired = 0x02, + AudioTypeVisualImpairedCommentary = 0x03 + }; + /* Some principles: - Objects that return references to other objects contained in their data must make sure that the returned objects have been parsed.