2011-06-01 23:34:35 +00:00
|
|
|
/*
|
|
|
|
* Humax EPG Tool
|
|
|
|
* by af123, 2011
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <time.h>
|
|
|
|
#include "lint.h"
|
|
|
|
|
|
|
|
int debug = 0;
|
|
|
|
const char *version = "0.0.1";
|
|
|
|
unsigned long sysopts = 0;
|
|
|
|
|
|
|
|
int
|
|
|
|
syntax()
|
|
|
|
{
|
|
|
|
fprintf(stderr, "Humax EPG Tool v%s, by af123, 2011.\n\n", version);
|
|
|
|
fprintf(stderr,
|
|
|
|
"Syntax: epg ...\n");
|
|
|
|
fprintf(stderr,
|
|
|
|
" Commands:\n"
|
|
|
|
);
|
|
|
|
fprintf(stderr, "\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
main(int argc, char **argv)
|
|
|
|
{
|
|
|
|
struct section_header *h;
|
|
|
|
struct data *d;
|
|
|
|
struct epg *epg;
|
|
|
|
|
2011-06-02 01:32:55 +00:00
|
|
|
if (!(epg = open_file("../epg.dat")))
|
2011-06-01 23:34:35 +00:00
|
|
|
return 0;
|
|
|
|
|
2011-06-02 01:32:55 +00:00
|
|
|
while (epg->offset < epg->binsize)
|
|
|
|
{
|
|
|
|
uint32_t end;
|
2011-06-01 23:34:35 +00:00
|
|
|
|
2011-06-02 01:32:55 +00:00
|
|
|
if (!(h = read_section_header(epg)))
|
|
|
|
break;
|
|
|
|
dump_section_header(h);
|
2011-06-01 23:34:35 +00:00
|
|
|
|
2011-06-02 01:32:55 +00:00
|
|
|
end = epg->offset - 11 + h->u1.u.length - 4;
|
|
|
|
|
|
|
|
while (epg->offset < end)
|
|
|
|
{
|
|
|
|
uint32_t dend;
|
|
|
|
|
|
|
|
if (!(d = read_data(epg)))
|
|
|
|
break;
|
|
|
|
dump_data(d);
|
|
|
|
|
|
|
|
dend = epg->offset + d->u1.u.descriptors_loop_length;
|
|
|
|
while (epg->offset < dend)
|
|
|
|
{
|
|
|
|
struct descriptor_header *dh;
|
|
|
|
|
|
|
|
dh = read_descriptor_header(epg);
|
|
|
|
dump_descriptor_header(dh);
|
|
|
|
|
|
|
|
epg->offset += dh->len;
|
|
|
|
}
|
|
|
|
//goto stop;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Section CRC */
|
|
|
|
epg->offset += 4;
|
|
|
|
|
|
|
|
/* Skip padding bytes... */
|
|
|
|
while (epg->bin[epg->offset] == 'U')
|
|
|
|
epg->offset++;
|
|
|
|
}
|
|
|
|
|
|
|
|
stop:
|
2011-06-01 23:34:35 +00:00
|
|
|
close_file(epg);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|