Add huffman decompression for EPG data

This commit is contained in:
hummypkg 2011-06-05 18:23:29 +00:00 committed by HummyPkg
parent 3c4211574f
commit b0255bc6b0
4 changed files with 5903 additions and 0 deletions

View File

@ -15,6 +15,7 @@ DEFS=-D_REENTRANT -D_TS_ERRNO -DHMT_PROTECT
SRCS= descriptor.c \
epg.c \
file.c \
huffman.c \
main.c \
util.c

View File

@ -64,6 +64,22 @@ read_lstring(struct epg *epg, unsigned int *len)
return c;
}
static void
uncompress_epg(char **epg, unsigned int *epglen)
{
char *new;
unsigned int newlen;
if ((new = (char *)
freeview_huffman_to_string((unsigned char *)(*epg),
*epglen, &newlen)))
{
free(*epg);
*epg = new;
*epglen = newlen;
}
}
void
read_descriptor(struct epg *epg, struct descriptor *d)
{
@ -78,6 +94,14 @@ read_descriptor(struct epg *epg, struct descriptor *d)
read_lstring(epg, &d->content.d77.namelen);
d->content.d77.text =
read_lstring(epg, &d->content.d77.textlen);
if (*d->content.d77.name == 0x1f)
uncompress_epg(&d->content.d77.name,
&d->content.d77.namelen);
if (*d->content.d77.text == 0x1f)
uncompress_epg(&d->content.d77.text,
&d->content.d77.textlen);
break;
case DS_COMPONENT:

5875
huffman.c Normal file

File diff suppressed because it is too large Load Diff

3
lint.h
View File

@ -40,6 +40,9 @@ void skip_descriptor(struct epg *, struct descriptor *);
void dump_descriptor(struct descriptor *, int);
void free_descriptor(struct descriptor *);
unsigned char *freeview_huffman_to_string(const unsigned char *, uint,
unsigned int *);
#ifdef sun
char *strcasestr (char *, char *);
#endif