dvb.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "scan.h"
00028
00029
00030
00031
00032 #define DMX "/dev/dvb/adapter%d/demux%d"
00033 #define FRONTEND "/dev/dvb/adapter%d/frontend%d"
00034 #define DVR "/dev/dvb/adapter%d/dvr%d"
00035 #define CA "/dev/dvb/adapter%d/ca%d"
00036
00037
00038
00039
00040 typedef struct demux_handle_t
00041 {
00042 int i_pid;
00043 int i_handle;
00044 int i_type;
00045 } demux_handle_t;
00046
00047 typedef struct frontend_t frontend_t;
00048 typedef struct
00049 {
00050 int i_snr;
00051 int i_ber;
00052 int i_signal_strenth;
00053 } frontend_statistic_t;
00054
00055 typedef struct
00056 {
00057 bool b_has_signal;
00058 bool b_has_carrier;
00059 bool b_has_lock;
00060 } frontend_status_t;
00061
00062 typedef struct en50221_session_t
00063 {
00064 int i_slot;
00065 int i_resource_id;
00066 void (* pf_handle)( access_t *, int, uint8_t *, int );
00067 void (* pf_close)( access_t *, int );
00068 void (* pf_manage)( access_t *, int );
00069 void *p_sys;
00070 } en50221_session_t;
00071
00072 #define EN50221_MMI_NONE 0
00073 #define EN50221_MMI_ENQ 1
00074 #define EN50221_MMI_ANSW 2
00075 #define EN50221_MMI_MENU 3
00076 #define EN50221_MMI_MENU_ANSW 4
00077 #define EN50221_MMI_LIST 5
00078
00079 typedef struct en50221_mmi_object_t
00080 {
00081 int i_object_type;
00082
00083 union
00084 {
00085 struct
00086 {
00087 bool b_blind;
00088 char *psz_text;
00089 } enq;
00090
00091 struct
00092 {
00093 bool b_ok;
00094 char *psz_answ;
00095 } answ;
00096
00097 struct
00098 {
00099 char *psz_title, *psz_subtitle, *psz_bottom;
00100 char **ppsz_choices;
00101 int i_choices;
00102 } menu;
00103
00104 struct
00105 {
00106 int i_choice;
00107 } menu_answ;
00108 } u;
00109 } en50221_mmi_object_t;
00110
00111 static __inline__ void en50221_MMIFree( en50221_mmi_object_t *p_object )
00112 {
00113 int i;
00114
00115 switch ( p_object->i_object_type )
00116 {
00117 case EN50221_MMI_ENQ:
00118 FREENULL( p_object->u.enq.psz_text );
00119 break;
00120
00121 case EN50221_MMI_ANSW:
00122 if ( p_object->u.answ.b_ok )
00123 {
00124 FREENULL( p_object->u.answ.psz_answ );
00125 }
00126 break;
00127
00128 case EN50221_MMI_MENU:
00129 case EN50221_MMI_LIST:
00130 FREENULL( p_object->u.menu.psz_title );
00131 FREENULL( p_object->u.menu.psz_subtitle );
00132 FREENULL( p_object->u.menu.psz_bottom );
00133 for ( i = 0; i < p_object->u.menu.i_choices; i++ )
00134 {
00135 free( p_object->u.menu.ppsz_choices[i] );
00136 }
00137 FREENULL( p_object->u.menu.ppsz_choices );
00138 break;
00139
00140 default:
00141 break;
00142 }
00143 }
00144
00145 #define MAX_DEMUX 256
00146 #define MAX_CI_SLOTS 16
00147 #define MAX_SESSIONS 32
00148 #define MAX_PROGRAMS 24
00149
00150 struct access_sys_t
00151 {
00152 int i_handle, i_frontend_handle;
00153 demux_handle_t p_demux_handles[MAX_DEMUX];
00154 frontend_t *p_frontend;
00155 bool b_budget_mode;
00156 bool b_scan_mode;
00157
00158
00159 int i_ca_handle;
00160 int i_ca_type;
00161 int i_nb_slots;
00162 bool pb_active_slot[MAX_CI_SLOTS];
00163 bool pb_tc_has_data[MAX_CI_SLOTS];
00164 bool pb_slot_mmi_expected[MAX_CI_SLOTS];
00165 bool pb_slot_mmi_undisplayed[MAX_CI_SLOTS];
00166 en50221_session_t p_sessions[MAX_SESSIONS];
00167 mtime_t i_ca_timeout, i_ca_next_event, i_frontend_timeout;
00168 dvbpsi_pmt_t *pp_selected_programs[MAX_PROGRAMS];
00169 int i_selected_programs;
00170
00171
00172 int i_read_once;
00173
00174 int i_stat_counter;
00175
00176 #ifdef ENABLE_HTTPD
00177
00178 httpd_host_t *p_httpd_host;
00179 httpd_file_sys_t *p_httpd_file;
00180 httpd_redirect_t *p_httpd_redir;
00181
00182 vlc_mutex_t httpd_mutex;
00183 vlc_cond_t httpd_cond;
00184 mtime_t i_httpd_timeout;
00185 bool b_request_frontend_info, b_request_mmi_info;
00186 char *psz_frontend_info, *psz_mmi_info;
00187 char *psz_request;
00188 #endif
00189
00190
00191 scan_t scan;
00192 };
00193
00194 #define VIDEO0_TYPE 1
00195 #define AUDIO0_TYPE 2
00196 #define TELETEXT0_TYPE 3
00197 #define SUBTITLE0_TYPE 4
00198 #define PCR0_TYPE 5
00199 #define TYPE_INTERVAL 5
00200 #define OTHER_TYPE 21
00201
00202
00203
00204
00205
00206 int FrontendOpen( access_t * );
00207 void FrontendPoll( access_t *p_access );
00208 int FrontendSet( access_t * );
00209 void FrontendClose( access_t * );
00210 #ifdef ENABLE_HTTPD
00211 void FrontendStatus( access_t * );
00212 #endif
00213
00214 int FrontendGetStatistic( access_t *, frontend_statistic_t * );
00215 void FrontendGetStatus( access_t *, frontend_status_t * );
00216 int FrontendGetScanParameter( access_t *, scan_parameter_t * );
00217
00218 int DMXSetFilter( access_t *, int i_pid, int * pi_fd, int i_type );
00219 int DMXUnsetFilter( access_t *, int i_fd );
00220
00221 int DVROpen( access_t * );
00222 void DVRClose( access_t * );
00223
00224 int CAMOpen( access_t * );
00225 int CAMPoll( access_t * );
00226 int CAMSet( access_t *, dvbpsi_pmt_t * );
00227 void CAMClose( access_t * );
00228 #ifdef ENABLE_HTTPD
00229 void CAMStatus( access_t * );
00230 #endif
00231
00232 int en50221_Init( access_t * );
00233 int en50221_Poll( access_t * );
00234 int en50221_SetCAPMT( access_t *, dvbpsi_pmt_t * );
00235 int en50221_OpenMMI( access_t * p_access, int i_slot );
00236 int en50221_CloseMMI( access_t * p_access, int i_slot );
00237 en50221_mmi_object_t *en50221_GetMMIObject( access_t * p_access,
00238 int i_slot );
00239 void en50221_SendMMIObject( access_t * p_access, int i_slot,
00240 en50221_mmi_object_t *p_object );
00241 void en50221_End( access_t * );
00242
00243 char *dvbsi_to_utf8( const char *psz_instring, size_t i_length );
00244
00245 #ifdef ENABLE_HTTPD
00246 int HTTPOpen( access_t *p_access );
00247 void HTTPClose( access_t *p_access );
00248 const char *HTTPExtractValue( const char *psz_uri, const char *psz_name,
00249 char *psz_value, int i_value_max );
00250 #endif
00251
00252
00253
00254 #define STRINGIFY( z ) UGLY_KLUDGE( z )
00255 #define UGLY_KLUDGE( z ) #z
00256