diff --git a/src/dvb/dvb.h b/src/dvb/dvb.h index a59a42ca..ef14d426 100644 --- a/src/dvb/dvb.h +++ b/src/dvb/dvb.h @@ -19,6 +19,13 @@ #ifndef DVB_H_ #define DVB_H_ +#include + +TAILQ_HEAD(th_dvb_adapter_queue, th_dvb_adapter); +RB_HEAD(th_dvb_mux_instance_tree, th_dvb_mux_instance); +TAILQ_HEAD(th_dvb_mux_instance_queue, th_dvb_mux_instance); + + enum polarisation { POLARISATION_HORIZONTAL = 0x00, POLARISATION_VERTICAL = 0x01, @@ -28,6 +35,111 @@ enum polarisation { #define DVB_FEC_ERROR_LIMIT 20 + +/** + * DVB Mux instance + */ +typedef struct th_dvb_mux_instance { + + RB_ENTRY(th_dvb_mux_instance) tdmi_global_link; + RB_ENTRY(th_dvb_mux_instance) tdmi_adapter_link; + + + struct th_dvb_adapter *tdmi_adapter; + + uint16_t tdmi_snr, tdmi_signal; + uint32_t tdmi_ber, tdmi_uncorrected_blocks; + +#define TDMI_FEC_ERR_HISTOGRAM_SIZE 10 + uint32_t tdmi_fec_err_histogram[TDMI_FEC_ERR_HISTOGRAM_SIZE]; + int tdmi_fec_err_ptr; + + time_t tdmi_time; + LIST_HEAD(, th_dvb_table) tdmi_tables; + + enum { + TDMI_FE_UNKNOWN, + TDMI_FE_NO_SIGNAL, + TDMI_FE_FAINT_SIGNAL, + TDMI_FE_BAD_SIGNAL, + TDMI_FE_CONSTANT_FEC, + TDMI_FE_BURSTY_FEC, + TDMI_FE_OK, + } tdmi_fe_status; + + int tdmi_quality; + + time_t tdmi_got_adapter; + time_t tdmi_lost_adapter; + + struct dvb_frontend_parameters tdmi_fe_params; + uint8_t tdmi_polarisation; /* for DVB-S */ + uint8_t tdmi_switchport; /* for DVB-S */ + + uint16_t tdmi_transport_stream_id; + + char *tdmi_identifier; + char *tdmi_network; /* Name of network, from NIT table */ + + struct th_transport_list tdmi_transports; /* via tht_mux_link */ + + + TAILQ_ENTRY(th_dvb_mux_instance) tdmi_scan_link; + struct th_dvb_mux_instance_queue *tdmi_scan_queue; + +} th_dvb_mux_instance_t; + + +#define DVB_MUX_SCAN_BAD 0 /* On the bad queue */ +#define DVB_MUX_SCAN_OK 1 /* Ok, don't need to scan that often */ +#define DVB_MUX_SCAN_INITIAL 2 /* To get a scan directly when a mux + is discovered */ + +/** + * DVB Adapter (one of these per physical adapter) + */ +typedef struct th_dvb_adapter { + + TAILQ_ENTRY(th_dvb_adapter) tda_global_link; + + struct th_dvb_mux_instance_tree tda_muxes; + + /** + * We keep our muxes on three queues in order to select how + * they are to be idle-scanned + */ + struct th_dvb_mux_instance_queue tda_scan_queues[3]; + int tda_scan_selector; /* To alternate between bad and ok queue */ + + th_dvb_mux_instance_t *tda_mux_current; + + int tda_table_epollfd; + + const char *tda_rootpath; + char *tda_identifier; + uint32_t tda_autodiscovery; + char *tda_displayname; + + int tda_fe_fd; + int tda_type; + struct dvb_frontend_info *tda_fe_info; + + char *tda_demux_path; + + char *tda_dvr_path; + + gtimer_t tda_mux_scanner_timer; + + pthread_mutex_t tda_delivery_mutex; + struct th_transport_list tda_transports; /* Currently bound transports */ + + gtimer_t tda_fe_monitor_timer; + int tda_fe_monitor_hold; + +} th_dvb_adapter_t; + + + extern struct th_dvb_adapter_queue dvb_adapters; extern struct th_dvb_mux_instance_tree dvb_muxes; diff --git a/src/dvb/dvb_support.h b/src/dvb/dvb_support.h index 984344b3..ae5ea75d 100644 --- a/src/dvb/dvb_support.h +++ b/src/dvb/dvb_support.h @@ -26,6 +26,8 @@ #ifndef DVB_SUPPORT_H #define DVB_SUPPORT_H +#include "dvb.h" + #define DVB_DESC_VIDEO_STREAM 0x02 #define DVB_DESC_CA 0x09 #define DVB_DESC_LANGUAGE 0x0a diff --git a/src/tvhead.h b/src/tvhead.h index 9628ba7a..b76913d7 100644 --- a/src/tvhead.h +++ b/src/tvhead.h @@ -36,8 +36,6 @@ #include "redblack.h" -#include - extern pthread_mutex_t global_lock; static inline void @@ -93,7 +91,6 @@ LIST_HEAD(th_subscription_list, th_subscription); RB_HEAD(channel_tree, channel); TAILQ_HEAD(channel_queue, channel); LIST_HEAD(channel_list, channel); -TAILQ_HEAD(th_dvb_adapter_queue, th_dvb_adapter); LIST_HEAD(event_list, event); RB_HEAD(event_tree, event); LIST_HEAD(dvr_entry_list, dvr_entry); @@ -101,8 +98,6 @@ TAILQ_HEAD(ref_update_queue, ref_update); LIST_HEAD(th_transport_list, th_transport); RB_HEAD(th_transport_tree, th_transport); TAILQ_HEAD(th_transport_queue, th_transport); -RB_HEAD(th_dvb_mux_instance_tree, th_dvb_mux_instance); -TAILQ_HEAD(th_dvb_mux_instance_queue, th_dvb_mux_instance); LIST_HEAD(th_stream_list, th_stream); LIST_HEAD(th_muxer_list, th_muxer); LIST_HEAD(th_muxstream_list, th_muxstream); @@ -180,110 +175,6 @@ typedef struct streaming_target { } streaming_target_t; - -/* - * DVB Mux instance - */ -typedef struct th_dvb_mux_instance { - - RB_ENTRY(th_dvb_mux_instance) tdmi_global_link; - RB_ENTRY(th_dvb_mux_instance) tdmi_adapter_link; - - - struct th_dvb_adapter *tdmi_adapter; - - uint16_t tdmi_snr, tdmi_signal; - uint32_t tdmi_ber, tdmi_uncorrected_blocks; - -#define TDMI_FEC_ERR_HISTOGRAM_SIZE 10 - uint32_t tdmi_fec_err_histogram[TDMI_FEC_ERR_HISTOGRAM_SIZE]; - int tdmi_fec_err_ptr; - - time_t tdmi_time; - LIST_HEAD(, th_dvb_table) tdmi_tables; - - enum { - TDMI_FE_UNKNOWN, - TDMI_FE_NO_SIGNAL, - TDMI_FE_FAINT_SIGNAL, - TDMI_FE_BAD_SIGNAL, - TDMI_FE_CONSTANT_FEC, - TDMI_FE_BURSTY_FEC, - TDMI_FE_OK, - } tdmi_fe_status; - - int tdmi_quality; - - time_t tdmi_got_adapter; - time_t tdmi_lost_adapter; - - struct dvb_frontend_parameters tdmi_fe_params; - uint8_t tdmi_polarisation; /* for DVB-S */ - uint8_t tdmi_switchport; /* for DVB-S */ - - uint16_t tdmi_transport_stream_id; - - char *tdmi_identifier; - char *tdmi_network; /* Name of network, from NIT table */ - - struct th_transport_list tdmi_transports; /* via tht_mux_link */ - - - TAILQ_ENTRY(th_dvb_mux_instance) tdmi_scan_link; - struct th_dvb_mux_instance_queue *tdmi_scan_queue; - -} th_dvb_mux_instance_t; - - -#define DVB_MUX_SCAN_BAD 0 /* On the bad queue */ -#define DVB_MUX_SCAN_OK 1 /* Ok, don't need to scan that often */ -#define DVB_MUX_SCAN_INITIAL 2 /* To get a scan directly when a mux - is discovered */ - -/* - * DVB Adapter (one of these per physical adapter) - */ -typedef struct th_dvb_adapter { - - TAILQ_ENTRY(th_dvb_adapter) tda_global_link; - - struct th_dvb_mux_instance_tree tda_muxes; - - /** - * We keep our muxes on three queues in order to select how - * they are to be idle-scanned - */ - struct th_dvb_mux_instance_queue tda_scan_queues[3]; - int tda_scan_selector; /* To alternate between bad and ok queue */ - - th_dvb_mux_instance_t *tda_mux_current; - - int tda_table_epollfd; - - const char *tda_rootpath; - char *tda_identifier; - uint32_t tda_autodiscovery; - char *tda_displayname; - - int tda_fe_fd; - int tda_type; - struct dvb_frontend_info *tda_fe_info; - - char *tda_demux_path; - - char *tda_dvr_path; - - gtimer_t tda_mux_scanner_timer; - - pthread_mutex_t tda_delivery_mutex; - struct th_transport_list tda_transports; /* Currently bound transports */ - - gtimer_t tda_fe_monitor_timer; - int tda_fe_monitor_hold; - -} th_dvb_adapter_t; - - /** * Descrambler superclass *