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

Implemented full handling of subtitling descriptors

This commit is contained in:
Klaus Schmidinger 2009-08-16 15:32:39 +02:00
parent be3ea31119
commit 9b61b20f9a
7 changed files with 47 additions and 13 deletions

View File

@ -2486,3 +2486,6 @@ G
Martin Neuditschko <yosuke.tomoe@gmx.net>
for reporting a problem with error messages from cDvbDevice::GetVideoSize()
on systems with no real primary replay device
Mikko Tuumanen <mikko.tuumanen@utu.fi>
for implementing full handling of subtitling descriptors

View File

@ -6155,3 +6155,4 @@ Video Disk Recorder Revision History
(thanks to Matthias Schwarzott).
- Increased the value of MAXFRAMESIZE to better suit HD recordings (thanks to
Reinhard Nissl).
- Implemented full handling of subtitling descriptors (thanks to Mikko Tuumanen).

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: channels.c 2.6 2009/04/25 13:57:32 kls Exp $
* $Id: channels.c 2.7 2009/08/16 15:08:49 kls Exp $
*/
#include "channels.h"
@ -533,6 +533,22 @@ void cChannel::SetPids(int Vpid, int Ppid, int Vtype, int *Apids, char ALangs[][
}
}
void cChannel::SetSubtitlingDescriptors(uchar *SubtitlingTypes, uint16_t *CompositionPageIds, uint16_t *AncillaryPageIds)
{
if (SubtitlingTypes) {
for (int i = 0; i < MAXSPIDS; i++)
subtitlingTypes[i] = SubtitlingTypes[i];
}
if (CompositionPageIds) {
for (int i = 0; i < MAXSPIDS; i++)
compositionPageIds[i] = CompositionPageIds[i];
}
if (AncillaryPageIds) {
for (int i = 0; i < MAXSPIDS; i++)
ancillaryPageIds[i] = AncillaryPageIds[i];
}
}
void cChannel::SetCaIds(const int *CaIds)
{
if (caids[0] && caids[0] <= CA_USER_MAX)

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: channels.h 2.4 2008/11/22 13:35:52 kls Exp $
* $Id: channels.h 2.5 2009/08/16 14:58:26 kls Exp $
*/
#ifndef __CHANNELS_H
@ -129,6 +129,9 @@ private:
char dlangs[MAXDPIDS][MAXLANGCODE2];
int spids[MAXSPIDS + 1]; // list is zero-terminated
char slangs[MAXSPIDS][MAXLANGCODE2];
uchar subtitlingTypes[MAXSPIDS];
uint16_t compositionPageIds[MAXSPIDS];
uint16_t ancillaryPageIds[MAXSPIDS];
int tpid;
int caids[MAXCAIDS + 1]; // list is zero-terminated
int nid;
@ -185,6 +188,9 @@ public:
const char *Alang(int i) const { return (0 <= i && i < MAXAPIDS) ? alangs[i] : ""; }
const char *Dlang(int i) const { return (0 <= i && i < MAXDPIDS) ? dlangs[i] : ""; }
const char *Slang(int i) const { return (0 <= i && i < MAXSPIDS) ? slangs[i] : ""; }
uchar SubtitlingType(int i) const { return (0 <= i && i < MAXSPIDS ? subtitlingTypes[i] : 0); }
uint16_t CompositionPageId(int i) const { return (0 <= i && i < MAXSPIDS ? compositionPageIds[i] : 0); }
uint16_t AncillaryPageId(int i) const { return (0 <= i && i < MAXSPIDS ? ancillaryPageIds[i] : 0); }
int Tpid(void) const { return tpid; }
const int *Caids(void) const { return caids; }
int Ca(int Index = 0) const { return Index < MAXCAIDS ? caids[Index] : 0; }
@ -226,6 +232,7 @@ public:
void SetCaDescriptors(int Level);
void SetLinkChannels(cLinkChannels *LinkChannels);
void SetRefChannel(cChannel *RefChannel);
void SetSubtitlingDescriptors(uchar *SubtitlingTypes, uint16_t *CompositionPageIds, uint16_t *AncillaryPageIds);
};
class cChannels : public cRwLock, public cConfig<cChannel> {

9
pat.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: pat.c 2.3 2009/08/15 22:16:02 kls Exp $
* $Id: pat.c 2.4 2009/08/16 15:01:03 kls Exp $
*/
#include "pat.h"
@ -334,6 +334,9 @@ void cPatFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
int Apids[MAXAPIDS + 1] = { 0 }; // these lists are zero-terminated
int Dpids[MAXDPIDS + 1] = { 0 };
int Spids[MAXSPIDS + 1] = { 0 };
uchar SubtitlingTypes[MAXSPIDS + 1] = { 0 };
uint16_t CompositionPageIds[MAXSPIDS + 1] = { 0 };
uint16_t AncillaryPageIds[MAXSPIDS + 1] = { 0 };
char ALangs[MAXAPIDS][MAXLANGCODE2] = { "" };
char DLangs[MAXDPIDS][MAXLANGCODE2] = { "" };
char SLangs[MAXSPIDS][MAXLANGCODE2] = { "" };
@ -405,6 +408,9 @@ void cPatFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
int n = 0;
for (SI::Loop::Iterator it; sd->subtitlingLoop.getNext(sub, it); ) {
if (sub.languageCode[0]) {
SubtitlingTypes[NumSpids] = sub.getSubtitlingType();
CompositionPageIds[NumSpids] = sub.getCompositionPageId();
AncillaryPageIds[NumSpids] = sub.getAncillaryPageId();
if (n > 0)
*s++ = '+';
strn0cpy(s, I18nNormalizeLanguageCode(sub.languageCode), MAXLANGCODE1);
@ -447,6 +453,7 @@ void cPatFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
if (Setup.UpdateChannels >= 2) {
Channel->SetPids(Vpid, Ppid, Vtype, Apids, ALangs, Dpids, DLangs, Spids, SLangs, Tpid);
Channel->SetCaIds(CaDescriptors->CaIds());
Channel->SetSubtitlingDescriptors(SubtitlingTypes, CompositionPageIds, AncillaryPageIds);
}
Channel->SetCaDescriptors(CaDescriptorHandler.AddCaDescriptors(CaDescriptors));
}

16
remux.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: remux.c 2.25 2009/06/21 13:30:03 kls Exp $
* $Id: remux.c 2.26 2009/08/16 15:13:42 kls Exp $
*/
#include "remux.h"
@ -198,7 +198,7 @@ int cPatPmtGenerator::MakeAC3Descriptor(uchar *Target)
return i;
}
int cPatPmtGenerator::MakeSubtitlingDescriptor(uchar *Target, const char *Language)
int cPatPmtGenerator::MakeSubtitlingDescriptor(uchar *Target, const char *Language, uchar SubtitlingType, uint16_t CompositionPageId, uint16_t AncillaryPageId)
{
int i = 0;
Target[i++] = SI::SubtitlingDescriptorTag;
@ -206,11 +206,11 @@ int cPatPmtGenerator::MakeSubtitlingDescriptor(uchar *Target, const char *Langua
Target[i++] = *Language++;
Target[i++] = *Language++;
Target[i++] = *Language++;
Target[i++] = 0x00; // subtitling type
Target[i++] = 0x00; // composition page id hi
Target[i++] = 0x01; // composition page id lo
Target[i++] = 0x00; // ancillary page id hi
Target[i++] = 0x01; // ancillary page id lo
Target[i++] = SubtitlingType;
Target[i++] = CompositionPageId >> 8;
Target[i++] = CompositionPageId & 0xFF;
Target[i++] = AncillaryPageId >> 8;
Target[i++] = AncillaryPageId & 0xFF;
IncEsInfoLength(i);
return i;
}
@ -327,7 +327,7 @@ void cPatPmtGenerator::GeneratePmt(cChannel *Channel)
}
for (int n = 0; Channel->Spid(n); n++) {
i += MakeStream(buf + i, 0x06, Channel->Spid(n));
i += MakeSubtitlingDescriptor(buf + i, Channel->Slang(n));
i += MakeSubtitlingDescriptor(buf + i, Channel->Slang(n), Channel->SubtitlingType(n), Channel->CompositionPageId(n), Channel->AncillaryPageId(n));
}
int sl = i - SectionLength - 2 + 4; // -2 = SectionLength storage, +4 = length of CRC

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: remux.h 2.18 2009/06/21 13:01:30 kls Exp $
* $Id: remux.h 2.19 2009/08/16 15:15:33 kls Exp $
*/
#ifndef __REMUX_H
@ -168,7 +168,7 @@ private:
protected:
int MakeStream(uchar *Target, uchar Type, int Pid);
int MakeAC3Descriptor(uchar *Target);
int MakeSubtitlingDescriptor(uchar *Target, const char *Language);
int MakeSubtitlingDescriptor(uchar *Target, const char *Language, uchar SubtitlingType, uint16_t CompositionPageId, uint16_t AncillaryPageId);
int MakeLanguageDescriptor(uchar *Target, const char *Language);
int MakeCRC(uchar *Target, const uchar *Data, int Length);
void GeneratePmtPid(cChannel *Channel);