2019-01-25 15:58:24 +00:00
|
|
|
/*
|
|
|
|
* Humax EPG Tool
|
|
|
|
* by af123, 2011
|
|
|
|
*/
|
2011-06-01 23:34:35 +00:00
|
|
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
|
2011-06-02 23:51:14 +00:00
|
|
|
#define DEFAULT_EPG_FILE "/mnt/hd1/dvbepg/epg.dat"
|
|
|
|
|
2011-06-01 23:34:35 +00:00
|
|
|
struct epg {
|
|
|
|
char fname[MAXPATHLEN + 1];
|
|
|
|
int fd;
|
|
|
|
uint8_t *bin;
|
|
|
|
uint32_t offset;
|
|
|
|
uint32_t binsize;
|
|
|
|
};
|
|
|
|
|
2011-06-02 11:14:43 +00:00
|
|
|
#define SECTION_MAGIC "(Gq\x87\x00\x00\x00\x00\x02\x00\x00\x00\x00\x01"
|
2011-06-01 23:34:35 +00:00
|
|
|
|
|
|
|
#pragma pack(1)
|
2011-06-02 11:14:43 +00:00
|
|
|
struct section {
|
2011-06-01 23:34:35 +00:00
|
|
|
char magic[14];
|
|
|
|
unsigned int total_length:16;
|
|
|
|
unsigned int magic2:32;
|
|
|
|
unsigned int table_id:8;
|
2011-06-02 01:32:55 +00:00
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
unsigned int length:12;
|
|
|
|
unsigned int reserved:3;
|
|
|
|
unsigned int syntax_indicator:1;
|
|
|
|
} u;
|
|
|
|
unsigned int comp:16;
|
|
|
|
} u1;
|
2011-06-01 23:34:35 +00:00
|
|
|
unsigned int service_id:16;
|
|
|
|
unsigned int current_next_indicator:1;
|
2011-06-02 01:32:55 +00:00
|
|
|
unsigned int version_number:5;
|
|
|
|
unsigned int reserved2:2;
|
2011-06-01 23:34:35 +00:00
|
|
|
unsigned int section_number:8;
|
|
|
|
unsigned int last_section_number:8;
|
|
|
|
unsigned int transport_stream_id:16;
|
|
|
|
unsigned int original_network_id:16;
|
|
|
|
unsigned int segment_last_section_number:8;
|
|
|
|
unsigned int last_table_id:8;
|
|
|
|
};
|
|
|
|
|
2011-06-02 11:14:43 +00:00
|
|
|
#pragma pack(1)
|
2011-06-01 23:34:35 +00:00
|
|
|
struct data {
|
|
|
|
unsigned int event_id:16;
|
|
|
|
unsigned int start_date:16;
|
2011-06-02 01:32:55 +00:00
|
|
|
unsigned int start_hour:8;
|
|
|
|
unsigned int start_min:8;
|
|
|
|
unsigned int start_sec:8;
|
|
|
|
unsigned int dur_hour:8;
|
|
|
|
unsigned int dur_min:8;
|
|
|
|
unsigned int dur_sec:8;
|
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
unsigned int descriptors_loop_length:12;
|
|
|
|
unsigned int free_CA_mode:1;
|
|
|
|
unsigned int running_status:3;
|
|
|
|
} u;
|
|
|
|
unsigned int comp:16;
|
|
|
|
} u1;
|
|
|
|
};
|
|
|
|
|
2011-06-03 10:27:40 +00:00
|
|
|
enum epgfiltertype {
|
2011-06-08 20:56:01 +00:00
|
|
|
FILTER_SERVICE = 0x1,
|
|
|
|
FILTER_EVENT = 0x2,
|
|
|
|
FILTER_DESCRIPTOR = 0x4,
|
|
|
|
FILTER_TIMESTAMP = 0x8,
|
|
|
|
FILTER_CRID = 0x10,
|
|
|
|
FILTER_SCRID = 0x20,
|
2011-09-29 18:23:24 +00:00
|
|
|
FILTER_CONTENT = 0x40,
|
|
|
|
FILTER_TIMERANGE = 0x80
|
2011-06-03 10:27:40 +00:00
|
|
|
};
|
|
|
|
|
2011-06-04 21:45:40 +00:00
|
|
|
enum matchtype { FT_EQUAL, FT_RANGE, FT_GREATER, FT_LESS };
|
|
|
|
|
2011-06-03 10:27:40 +00:00
|
|
|
struct epgfilter {
|
|
|
|
enum epgfiltertype type;
|
2011-06-04 21:45:40 +00:00
|
|
|
unsigned long num;
|
|
|
|
unsigned long num2;
|
2011-06-03 10:27:40 +00:00
|
|
|
char *str;
|
|
|
|
|
2011-06-04 21:45:40 +00:00
|
|
|
enum matchtype match;
|
|
|
|
|
2011-06-03 10:27:40 +00:00
|
|
|
struct epgfilter *next;
|
|
|
|
};
|
|
|
|
|