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