static void epggrab_ota_done ( epggrab_ota_mux_t *om, int reason ) { static const char *reasons[] = { [EPGGRAB_OTA_DONE_COMPLETE] = "complete", [EPGGRAB_OTA_DONE_TIMEOUT] = "timeout", [EPGGRAB_OTA_DONE_NO_DATA] = "no data", [EPGGRAB_OTA_DONE_STOLEN] = "stolen" }; char ubuf[UUID_HEX_SIZE]; mpegts_mux_t *mm; epggrab_ota_map_t *map; if (om->om_save) epggrab_ota_save(om); mm = mpegts_mux_find0(&om->om_mux_uuid); if (mm == NULL) { tvhdebug(LS_EPGGRAB, "unable to find mux %s (grab done: %s)", uuid_get_hex(&om->om_mux_uuid, ubuf), reasons[reason]); return; } tvhdebug(LS_EPGGRAB, "grab done for %s (%s)", mm->mm_nicename, reasons[reason]); mtimer_disarm(&om->om_timer); mtimer_disarm(&om->om_data_timer); mtimer_disarm(&om->om_handlers_timer); assert(om->om_q_type == EPGGRAB_OTA_MUX_ACTIVE); TAILQ_REMOVE(&epggrab_ota_active, om, om_q_link); om->om_q_type = EPGGRAB_OTA_MUX_IDLE; LIST_FOREACH(map, &om->om_modules, om_link) if (map->om_module->stop) map->om_module->stop(map, mm); if (reason == EPGGRAB_OTA_DONE_STOLEN) { /* Do not requeue completed muxes */ if (!om->om_done && om->om_requeue) { TAILQ_INSERT_HEAD(&epggrab_ota_pending, om, om_q_link); om->om_q_type = EPGGRAB_OTA_MUX_PENDING; } else { om->om_requeue = 0; } } else if (reason == EPGGRAB_OTA_DONE_TIMEOUT) { om->om_requeue = 0; LIST_FOREACH(map, &om->om_modules, om_link) if (!map->om_complete) tvhwarn(LS_EPGGRAB, "%s - data completion timeout for %s", map->om_module->name, mm->mm_nicename); } else {
void tvhdhomerun_device_destroy( tvhdhomerun_device_t *hd ) { tvhdhomerun_frontend_t *lfe; lock_assert(&global_lock); mtimer_disarm(&hd->hd_destroy_timer); idnode_save_check(&hd->th_id, 0); tvhinfo(LS_TVHDHOMERUN, "Releasing locks for devices"); while ((lfe = TAILQ_FIRST(&hd->hd_frontends)) != NULL) { tvhdhomerun_frontend_delete(lfe); } #define FREEM(x) free(hd->hd_info.x) FREEM(friendlyname); FREEM(uuid); FREEM(deviceModel); #undef FREEM tvh_hardware_delete((tvh_hardware_t*)hd); #define FREEM(x) free(hd->x) FREEM(hd_override_type); #undef FREEM free(hd); }
/* * Stop connection */ static void iptv_rtsp_stop ( iptv_mux_t *im ) { rtsp_priv_t *rp = im->im_data; int play; lock_assert(&global_lock); if (rp == NULL) return; play = rp->play; im->im_data = NULL; rp->hc->hc_aux = NULL; if (play) rtsp_teardown(rp->hc, rp->path, ""); pthread_mutex_unlock(&iptv_lock); mtimer_disarm(&rp->alive_timer); udp_multirecv_free(&rp->um); if (!play) http_client_close(rp->hc); free(rp->path); free(rp->query); rtcp_destroy(rp->rtcp_info); free(rp->rtcp_info); free(rp); pthread_mutex_lock(&iptv_lock); }
void mpegts_network_scan_queue_del ( mpegts_mux_t *mm ) { mpegts_network_t *mn = mm->mm_network; char buf[256], buf2[256]; if (mm->mm_scan_state == MM_SCAN_STATE_ACTIVE) { TAILQ_REMOVE(&mn->mn_scan_active, mm, mm_scan_link); } else if (mm->mm_scan_state == MM_SCAN_STATE_PEND) { TAILQ_REMOVE(&mn->mn_scan_pend, mm, mm_scan_link); } mpegts_mux_nice_name(mm, buf, sizeof(buf)); mn->mn_display_name(mn, buf2, sizeof(buf2)); tvhdebug(LS_MPEGTS, "%s - removing mux %s from scan queue", buf2, buf); mm->mm_scan_state = MM_SCAN_STATE_IDLE; mm->mm_scan_weight = 0; mtimer_disarm(&mm->mm_scan_timeout); mtimer_arm_rel(&mn->mn_scan_timer, mpegts_network_scan_timer_cb, mn, 0); mpegts_network_scan_notify(mm); }