98 lines
1.5 KiB
C
98 lines
1.5 KiB
C
/*
|
|
* 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 *h;
|
|
struct epg *epg;
|
|
|
|
if (!(epg = open_file("../epg.dat")))
|
|
return 0;
|
|
|
|
while (epg->offset < epg->binsize)
|
|
{
|
|
uint32_t send;
|
|
|
|
if (!(h = read_section(epg)))
|
|
break;
|
|
//dump_section(h);
|
|
|
|
send = epg->offset - 11 + h->u1.u.length - 4;
|
|
|
|
while (epg->offset < send)
|
|
{
|
|
struct data *d;
|
|
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 *ds;
|
|
|
|
ds = read_descriptor_header(epg);
|
|
if (ds->tag == DS_SHORT_EVENT)
|
|
{
|
|
read_descriptor(epg, ds);
|
|
dump_descriptor(ds, 1);
|
|
}
|
|
else
|
|
{
|
|
dump_descriptor(ds, 0);
|
|
skip_descriptor(epg, ds);
|
|
}
|
|
printf("Offset: %d / %d\n", epg->offset, dend);
|
|
}
|
|
}
|
|
|
|
/* Skip CRC */
|
|
epg->offset += 4;
|
|
|
|
/* Skip padding bytes... */
|
|
while (epg->bin[epg->offset] == 'U')
|
|
epg->offset++;
|
|
}
|
|
|
|
stop:
|
|
close_file(epg);
|
|
|
|
return 0;
|
|
}
|
|
|