decompress warning text if necessary, add support for parsing FTA_CONTENT_MGMT and LINKAGE descriptors

This commit is contained in:
hummypkg 2011-06-06 14:43:58 +00:00 committed by HummyPkg
parent bceec434b9
commit 6144e4386e
4 changed files with 100 additions and 5 deletions

View File

@ -105,6 +105,24 @@ read_descriptor(struct epg *epg, struct descriptor *d)
&d->content.d137.warninglen);
break;
case DS_LINKAGE:
memcpy(&d->content.d74, epg->bin + epg->offset,
sizeof(d->content.d74));
epg->offset += d->len;
d->content.d74.tsid = _swap16(d->content.d74.tsid);
d->content.d74.orig_netid = _swap16(d->content.d74.orig_netid);
d->content.d74.service_id = _swap16(d->content.d74.service_id);
if (d->content.d74.linkage_type == 8)
d->content.d74.l.l8.id =
_swap16(d->content.d74.l.l8.id);
else
d->content.d74.l.ld.event_id =
_swap16(d->content.d74.l.ld.event_id);
break;
case DS_CONTENT:
{
unsigned int end = epg->offset + d->len;
@ -122,6 +140,12 @@ read_descriptor(struct epg *epg, struct descriptor *d)
break;
}
case DS_FTA_CONTENT_MGMT:
memcpy(&d->content.d126, epg->bin + epg->offset,
sizeof(d->content.d126));
epg->offset += d->len;
break;
case DS_CONTENT_IDENTIFIER:
{
unsigned int end = epg->offset + d->len;
@ -164,10 +188,8 @@ read_descriptor(struct epg *epg, struct descriptor *d)
}
default:
printf("Default descriptor: %d\n", d->tag);
case DS_LINKAGE:
printf("WARNING: Default descriptor: %d\n", d->tag);
case DS_PRIVATE_DATA_SPECIFIER:
case DS_FTA_CONTENT_MGMT:
d->content.unknown.text = string_to_end(epg, d, 0,
&d->content.unknown.textlen);
break;
@ -220,6 +242,8 @@ free_descriptor(struct descriptor *d)
}
case DS_CONTENT:
case DS_FTA_CONTENT_MGMT:
case DS_LINKAGE:
break;
default:
@ -338,13 +362,39 @@ dump_descriptor(struct descriptor *d, int content)
}
case DS_CONTENT:
{
DUMPINT(d, content.d84.level1);
DUMPINT(d, content.d84.level2);
DUMPINT(d, content.d84.user);
printf("%30s: %s\n", "Type", content_type(d));
break;
}
case DS_FTA_CONTENT_MGMT:
DUMPINT(d, content.d126.reserved);
DUMPINT(d, content.d126.no_scramble);
DUMPINT(d, content.d126.control_remote_access);
DUMPINT(d, content.d126.no_revocation);
break;
case DS_LINKAGE:
DUMPINT(d, content.d74.tsid);
DUMPINT(d, content.d74.orig_netid);
DUMPINT(d, content.d74.service_id);
DUMPINT(d, content.d74.linkage_type);
if (d->content.d74.linkage_type == 8)
{
DUMPINT(d, content.d74.l.l8.handover_type);
DUMPINT(d, content.d74.l.l8.reserved);
DUMPINT(d, content.d74.l.l8.origin_type);
DUMPINT(d, content.d74.l.l8.id);
}
else if (d->content.d74.linkage_type == 13)
{
DUMPINT(d, content.d74.l.ld.event_id);
DUMPINT(d, content.d74.l.ld.listed);
DUMPINT(d, content.d74.l.ld.simulcast);
DUMPINT(d, content.d74.l.ld.reserved);
}
break;
default:
if (d->content.unknown.textlen)

View File

@ -65,6 +65,32 @@ struct descriptor {
char *warning;
unsigned int warninglen;
} d137; /* USER_DEFINED - content warnings? */
struct {
unsigned int no_revocation:1;
unsigned int control_remote_access:2;
unsigned int no_scramble:1;
unsigned int reserved:4;
} d126; /* DS_FTA_CONTENT_MGMT */
struct {
unsigned int tsid:16;
unsigned int orig_netid:16;
unsigned int service_id:16;
unsigned int linkage_type:8;
union {
struct {
unsigned int origin_type:1;
unsigned int reserved:3;
unsigned int handover_type:4;
unsigned int id:16;
} l8;
struct {
unsigned int event_id:16;
unsigned int reserved:6;
unsigned int simulcast:1;
unsigned int listed:1;
} ld;
} l;
} d74; /* DS_LINKAGE */
struct {
struct crid crids[3];
int i;

14
epg.c
View File

@ -276,6 +276,20 @@ parse(char *epgpath,
dslist[PARSER_CONTENT] = ds;
break;
/*
case DS_FTA_CONTENT_MGMT:
read_descriptor(epg, ds);
dump_descriptor(ds, 1);
free_descriptor(ds);
break;
case DS_LINKAGE:
read_descriptor(epg, ds);
dump_descriptor(ds, 1);
free_descriptor(ds);
break;
*/
default:
skip_descriptor(epg, ds);
free_descriptor(ds);

5
main.c
View File

@ -112,6 +112,11 @@ dump(struct epg *epg __attribute__((unused)),
DECOMPRESS(d77->content.d77.name, d77->content.d77.namelen);
DECOMPRESS(d77->content.d77.text, d77->content.d77.textlen);
}
if (ds[PARSER_USER_DEFINED])
{
struct descriptor *d = ds[PARSER_USER_DEFINED];
DECOMPRESS(d->content.d137.warning, d->content.d137.warninglen);
}
if (sysopts & SYSOPT_PARSABLE)
{