epg/epg.h

91 lines
1.8 KiB
C

/*
* Humax EPG Tool
* by af123, 2011
*/
#include <sys/param.h>
#define DEFAULT_EPG_FILE "/mnt/hd1/dvbepg/epg.dat"
struct epg {
char fname[MAXPATHLEN + 1];
int fd;
uint8_t *bin;
uint32_t offset;
uint32_t binsize;
};
#define SECTION_MAGIC "(Gq\x87\x00\x00\x00\x00\x02\x00\x00\x00\x00\x01"
#pragma pack(1)
struct section {
char magic[14];
unsigned int total_length:16;
unsigned int magic2:32;
unsigned int table_id:8;
union {
struct {
unsigned int length:12;
unsigned int reserved:3;
unsigned int syntax_indicator:1;
} u;
unsigned int comp:16;
} u1;
unsigned int service_id:16;
unsigned int current_next_indicator:1;
unsigned int version_number:5;
unsigned int reserved2:2;
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;
};
#pragma pack(1)
struct data {
unsigned int event_id:16;
unsigned int start_date:16;
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;
};
enum epgfiltertype {
FILTER_SERVICE = 0x1,
FILTER_EVENT = 0x2,
FILTER_DESCRIPTOR = 0x4,
FILTER_TIMESTAMP = 0x8,
FILTER_CRID = 0x10,
FILTER_SCRID = 0x20,
FILTER_CONTENT = 0x40,
FILTER_TIMERANGE = 0x80,
FILTER_GUIDETYPE = 0x100
};
enum matchtype { FT_EQUAL, FT_RANGE, FT_GREATER, FT_LESS };
struct epgfilter {
enum epgfiltertype type;
unsigned long num;
unsigned long num2;
char *str;
enum matchtype match;
struct epgfilter *next;
};