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)
|
|
|
|
{
|
2011-06-02 11:14:43 +00:00
|
|
|
struct section *h;
|
2011-06-01 23:34:35 +00:00
|
|
|
struct epg *epg;
|
2011-06-02 15:21:56 +00:00
|
|
|
int i = 0;
|
2011-06-01 23:34:35 +00:00
|
|
|
|
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)
|
|
|
|
{
|
2011-06-02 11:14:43 +00:00
|
|
|
uint32_t send;
|
2011-06-01 23:34:35 +00:00
|
|
|
|
2011-06-02 11:14:43 +00:00
|
|
|
if (!(h = read_section(epg)))
|
2011-06-02 01:32:55 +00:00
|
|
|
break;
|
2011-06-02 15:21:56 +00:00
|
|
|
//dump_section(h);
|
2011-06-01 23:34:35 +00:00
|
|
|
|
2011-06-02 11:14:43 +00:00
|
|
|
send = epg->offset - 11 + h->u1.u.length - 4;
|
2011-06-02 01:32:55 +00:00
|
|
|
|
2011-06-02 11:14:43 +00:00
|
|
|
while (epg->offset < send)
|
2011-06-02 01:32:55 +00:00
|
|
|
{
|
2011-06-02 11:14:43 +00:00
|
|
|
struct data *d;
|
2011-06-02 01:32:55 +00:00
|
|
|
uint32_t dend;
|
|
|
|
|
|
|
|
if (!(d = read_data(epg)))
|
|
|
|
break;
|
2011-06-02 15:21:56 +00:00
|
|
|
//dump_data(d);
|
2011-06-02 01:32:55 +00:00
|
|
|
|
|
|
|
dend = epg->offset + d->u1.u.descriptors_loop_length;
|
|
|
|
while (epg->offset < dend)
|
|
|
|
{
|
2011-06-02 11:14:43 +00:00
|
|
|
struct descriptor *ds;
|
|
|
|
|
|
|
|
ds = read_descriptor_header(epg);
|
2011-06-02 14:38:25 +00:00
|
|
|
read_descriptor(epg, ds);
|
2011-06-02 15:21:56 +00:00
|
|
|
|
2011-06-02 15:25:00 +00:00
|
|
|
/*
|
2011-06-02 15:21:56 +00:00
|
|
|
if (ds->tag == DS_CONTENT_IDENTIFIER)
|
|
|
|
dump_descriptor(ds, 1);
|
2011-06-02 15:25:00 +00:00
|
|
|
*/
|
2011-06-02 15:21:56 +00:00
|
|
|
|
|
|
|
free_descriptor(ds);
|
2011-06-02 01:32:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-06-02 11:14:43 +00:00
|
|
|
/* Skip CRC */
|
2011-06-02 01:32:55 +00:00
|
|
|
epg->offset += 4;
|
|
|
|
|
|
|
|
/* Skip padding bytes... */
|
|
|
|
while (epg->bin[epg->offset] == 'U')
|
|
|
|
epg->offset++;
|
|
|
|
}
|
|
|
|
|
2011-06-01 23:34:35 +00:00
|
|
|
close_file(epg);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|