/* * Humax EPG Tool * by af123, 2011 */ #include #ifdef FOXSATFILE #define DEFAULT_EPG_FILE "/mnt/hd2/fsatepg/epg.dat" #else #define DEFAULT_EPG_FILE "/mnt/hd1/dvbepg/epg.dat" #endif struct epg { char fname[MAXPATHLEN + 1]; int fd; uint8_t *bin; uint32_t offset; uint32_t binsize; }; #ifdef FOXSATFILE #define SECTION_MAGIC "\x19\x77\x09\x29\xff\xff" #else #define SECTION_MAGIC "(Gq\x87\x00\x00\x00\x00\x02\x00\x00\x00\x00\x01" #endif #pragma pack(1) struct section { #ifdef FOXSATFILE char magic[6]; #else char magic[14]; #endif unsigned int total_length:16; #ifndef FOXSATFILE unsigned int magic2:32; #endif unsigned int table_id:8; union { struct { #ifdef FOXSATPLATFORM unsigned int syntax_indicator:1; unsigned int reserved:3; unsigned int length:12; #else unsigned int length:12; unsigned int reserved:3; unsigned int syntax_indicator:1; #endif } u; unsigned int comp:16; } u1; unsigned int service_id:16; #ifdef FOXSATPLATFORM unsigned int reserved2:2; unsigned int version_number:5; unsigned int current_next_indicator:1; #else unsigned int current_next_indicator:1; unsigned int version_number:5; unsigned int reserved2:2; #endif 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 { #ifdef FOXSATPLATFORM unsigned int running_status:3; unsigned int free_CA_mode:1; unsigned int descriptors_loop_length:12; #else unsigned int descriptors_loop_length:12; unsigned int free_CA_mode:1; unsigned int running_status:3; #endif } 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 }; 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; };