1 /* 2 * EPG Grabber - private routines 3 * Copyright (C) 2012 Adam Sutton 4 * 5 * This program is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 */ 18 19 #ifndef __EPGGRAB_PRIVATE_H__ 20 #define __EPGGRAB_PRIVATE_H__ 21 22 struct mpegts_mux; 23 24 /* ************************************************************************** 25 * Generic module routines 26 * *************************************************************************/ 27 28 epggrab_module_t *epggrab_module_create 29 ( epggrab_module_t *skel, const idclass_t *cls, 30 const char *id, int subsys, const char *saveid, 31 const char *name, int priority ); 32 33 char *epggrab_module_grab_spawn ( void *m ); 34 htsmsg_t *epggrab_module_trans_xml ( void *m, char *data ); 35 36 void epggrab_module_ch_add ( void *m, struct channel *ch ); 37 void epggrab_module_ch_rem ( void *m, struct channel *ch ); 38 void epggrab_module_ch_mod ( void *m, struct channel *ch ); 39 void epggrab_module_ch_save ( void *m, epggrab_channel_t *ec ); 40 41 void epggrab_module_parse ( void *m, htsmsg_t *data ); 42 43 void epggrab_module_channels_load ( const char *modid ); 44 45 /* ************************************************************************** 46 * Channel processing 47 * *************************************************************************/ 48 49 int epggrab_channel_match_epgid ( epggrab_channel_t *ec, struct channel *ch ); 50 int epggrab_channel_match_name ( epggrab_channel_t *ec, struct channel *ch ); 51 int epggrab_channel_match_number ( epggrab_channel_t *ec, struct channel *ch ); 52 53 epggrab_channel_t *epggrab_channel_create 54 ( epggrab_module_t *owner, htsmsg_t *conf, const char *uuid ); 55 56 epggrab_channel_t *epggrab_channel_find 57 ( epggrab_module_t *mod, const char *id, int create, int *save ); 58 59 void epggrab_channel_save ( epggrab_channel_t *ec ); 60 void epggrab_channel_destroy 61 ( epggrab_channel_t *ec, int delconf, int rb_remove ); 62 void epggrab_channel_flush 63 ( epggrab_module_t *mod, int delconf ); 64 void epggrab_channel_begin_scan 65 ( epggrab_module_t *mod ); 66 void epggrab_channel_end_scan 67 ( epggrab_module_t *mod ); 68 69 void epggrab_channel_init(void); 70 void epggrab_channel_done(void); 71 72 /* ************************************************************************** 73 * Internal module routines 74 * *************************************************************************/ 75 76 epggrab_module_int_t *epggrab_module_int_create 77 ( epggrab_module_int_t *skel, const idclass_t *cls, 78 const char *id, int subsys, const char *saveid, 79 const char *name, int priority, 80 const char *path, 81 char* (*grab) (void*m), 82 int (*parse) (void *m, htsmsg_t *data, epggrab_stats_t *sta), 83 htsmsg_t* (*trans) (void *mod, char *data) ); 84 85 /* ************************************************************************** 86 * External module routines 87 * *************************************************************************/ 88 89 epggrab_module_ext_t *epggrab_module_ext_create 90 ( epggrab_module_ext_t *skel, const idclass_t *cls, 91 const char *id, int subsys, const char *saveid, 92 const char *name, int priority, 93 const char *sockid, 94 int (*parse) (void *m, htsmsg_t *data, epggrab_stats_t *sta), 95 htsmsg_t* (*trans) (void *mod, char *data) ); 96 97 /* ************************************************************************** 98 * OTA module routines 99 * *************************************************************************/ 100 101 typedef struct epggrab_ota_module_ops { 102 int (*start) (epggrab_ota_map_t *map, struct mpegts_mux *mm); 103 int (*activate) (void *m, int e); 104 void (*done) (void *m); 105 int (*tune) (epggrab_ota_map_t *map, epggrab_ota_mux_t *om, 106 struct mpegts_mux *mm); 107 void *opaque; 108 } epggrab_ota_module_ops_t; 109 110 epggrab_module_ota_t *epggrab_module_ota_create 111 ( epggrab_module_ota_t *skel, 112 const char *id, int subsys, const char *saveid, 113 const char *name, int priority, 114 epggrab_ota_module_ops_t *ops ); 115 116 /* ************************************************************************** 117 * OTA mux link routines 118 * *************************************************************************/ 119 120 /* 121 * Config handling 122 */ 123 void epggrab_ota_init ( void ); 124 125 /* 126 * Create/Find a link (unregistered) 127 * 128 * Note: this will return NULL for an already existing link that is currently 129 * blocked (i.e. has completed within interval period) 130 */ 131 epggrab_ota_mux_t *epggrab_ota_find 132 ( epggrab_module_ota_t *mod, struct mpegts_mux *dm ); 133 epggrab_ota_mux_t *epggrab_ota_create 134 ( epggrab_module_ota_t *mod, struct mpegts_mux *dm ); 135 void epggrab_ota_create_and_register_by_id 136 ( epggrab_module_ota_t *mod, uint16_t onid, uint16_t tsid, 137 int period, int interval, const char *name ); 138 139 /* 140 * Delete 141 */ 142 void epggrab_ota_destroy ( epggrab_ota_mux_t *ota ); 143 void epggrab_ota_destroy_by_module ( epggrab_module_ota_t *mod ); 144 #if 0 145 void epggrab_ota_destroy_by_dm ( struct dvb_mux *dm ); 146 #endif 147 148 /* 149 * In module functions 150 */ 151 152 epggrab_ota_mux_t *epggrab_ota_register 153 ( epggrab_module_ota_t *mod, epggrab_ota_mux_t *ota, 154 struct mpegts_mux *mux ); 155 156 /* 157 * State change 158 */ 159 void epggrab_ota_complete 160 ( epggrab_module_ota_t *mod, epggrab_ota_mux_t *ota ); 161 162 /* 163 * Service list 164 */ 165 void 166 epggrab_ota_service_add 167 ( epggrab_ota_map_t *map, epggrab_ota_mux_t *ota, 168 const char *uuid, int save ); 169 void 170 epggrab_ota_service_del 171 ( epggrab_ota_map_t *map, epggrab_ota_mux_t *ota, 172 epggrab_ota_svc_link_t *svcl, int save ); 173 174 /* ************************************************************************** 175 * Miscellaneous 176 * *************************************************************************/ 177 178 /* Note: this is reused by pyepg since they share a common format */ 179 int xmltv_parse_accessibility 180 ( epg_broadcast_t *ebc, htsmsg_t *m, uint32_t *changes ); 181 182 /* Freesat huffman decoder */ 183 size_t freesat_huffman_decode 184 ( char *dst, size_t* dstlen, const uint8_t *src, size_t srclen ); 185 186 /* ************************************************************************** 187 * Classes 188 * *************************************************************************/ 189 190 extern const idclass_t epggrab_mod_class; 191 extern const idclass_t epggrab_mod_int_class; 192 extern const idclass_t epggrab_mod_int_pyepg_class; 193 extern const idclass_t epggrab_mod_int_xmltv_class; 194 extern const idclass_t epggrab_mod_ext_class; 195 extern const idclass_t epggrab_mod_ext_pyepg_class; 196 extern const idclass_t epggrab_mod_ext_xmltv_class; 197 extern const idclass_t epggrab_mod_ota_class; 198 199 /* ************************************************************************** 200 * Module setup(s) 201 * *************************************************************************/ 202 203 /* EIT module */ 204 void eit_init ( void ); 205 void eit_done ( void ); 206 void eit_load ( void ); 207 208 /* OpenTV module */ 209 void opentv_init ( void ); 210 void opentv_done ( void ); 211 void opentv_load ( void ); 212 213 /* PyEPG module */ 214 void pyepg_init ( void ); 215 void pyepg_done ( void ); 216 void pyepg_load ( void ); 217 218 /* XMLTV module */ 219 void xmltv_init ( void ); 220 void xmltv_done ( void ); 221 void xmltv_load ( void ); 222 223 /* PSIP module */ 224 void psip_init ( void ); 225 void psip_done ( void ); 226 void psip_load ( void ); 227 228 #endif /* __EPGGRAB_PRIVATE_H__ */ 229