1 /*****************************************************************************
2 * dvb.h : functions to control a DVB card under Linux with v4l2
3 *****************************************************************************
4 * Copyright (C) 1998-2005 the VideoLAN team
6 * Authors: Johan Bilien <jobi@via.ecp.fr>
7 * Jean-Paul Saman <jpsaman _at_ videolan _dot_ org>
8 * Christopher Ross <chris@tebibyte.org>
9 * Christophe Massiot <massiot@via.ecp.fr>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
24 *****************************************************************************/
27 /*****************************************************************************
29 *****************************************************************************/
30 #define DMX "/dev/dvb/adapter%d/demux%d"
31 #define FRONTEND "/dev/dvb/adapter%d/frontend%d"
32 #define DVR "/dev/dvb/adapter%d/dvr%d"
33 #define CA "/dev/dvb/adapter%d/ca%d"
35 /*****************************************************************************
37 *****************************************************************************/
38 typedef struct demux_handle_t
45 typedef struct frontend_t frontend_t;
47 typedef struct en50221_session_t
51 void (* pf_handle)( access_t *, int, uint8_t *, int );
52 void (* pf_close)( access_t *, int );
53 void (* pf_manage)( access_t *, int );
57 #define EN50221_MMI_NONE 0
58 #define EN50221_MMI_ENQ 1
59 #define EN50221_MMI_ANSW 2
60 #define EN50221_MMI_MENU 3
61 #define EN50221_MMI_MENU_ANSW 4
62 #define EN50221_MMI_LIST 5
64 typedef struct en50221_mmi_object_t
84 char *psz_title, *psz_subtitle, *psz_bottom;
87 } menu; /* menu and list are the same */
94 } en50221_mmi_object_t;
96 static __inline__ void en50221_MMIFree( en50221_mmi_object_t *p_object )
100 switch ( p_object->i_object_type )
102 case EN50221_MMI_ENQ:
103 FREENULL( p_object->u.enq.psz_text );
106 case EN50221_MMI_ANSW:
107 if ( p_object->u.answ.b_ok )
109 FREENULL( p_object->u.answ.psz_answ );
113 case EN50221_MMI_MENU:
114 case EN50221_MMI_LIST:
115 FREENULL( p_object->u.menu.psz_title );
116 FREENULL( p_object->u.menu.psz_subtitle );
117 FREENULL( p_object->u.menu.psz_bottom );
118 for ( i = 0; i < p_object->u.menu.i_choices; i++ )
120 FREENULL( p_object->u.menu.ppsz_choices[i] );
122 FREENULL( p_object->u.menu.ppsz_choices );
130 #define MAX_DEMUX 256
131 #define MAX_CI_SLOTS 16
132 #define MAX_SESSIONS 32
133 #define MAX_PROGRAMS 24
137 int i_handle, i_frontend_handle;
138 demux_handle_t p_demux_handles[MAX_DEMUX];
139 frontend_t *p_frontend;
140 vlc_bool_t b_budget_mode;
146 vlc_bool_t pb_active_slot[MAX_CI_SLOTS];
147 vlc_bool_t pb_tc_has_data[MAX_CI_SLOTS];
148 vlc_bool_t pb_slot_mmi_expected[MAX_CI_SLOTS];
149 vlc_bool_t pb_slot_mmi_undisplayed[MAX_CI_SLOTS];
150 en50221_session_t p_sessions[MAX_SESSIONS];
151 mtime_t i_ca_timeout, i_ca_next_event, i_frontend_timeout;
152 dvbpsi_pmt_t *pp_selected_programs[MAX_PROGRAMS];
153 int i_selected_programs;
159 /* Local HTTP server */
160 httpd_host_t *p_httpd_host;
161 httpd_file_sys_t *p_httpd_file;
162 httpd_redirect_t *p_httpd_redir;
164 vlc_mutex_t httpd_mutex;
165 vlc_cond_t httpd_cond;
166 mtime_t i_httpd_timeout;
167 vlc_bool_t b_request_frontend_info, b_request_mmi_info;
168 char *psz_frontend_info, *psz_mmi_info;
173 #define VIDEO0_TYPE 1
174 #define AUDIO0_TYPE 2
175 #define TELETEXT0_TYPE 3
176 #define SUBTITLE0_TYPE 4
178 #define TYPE_INTERVAL 5
179 #define OTHER_TYPE 21
181 /*****************************************************************************
183 *****************************************************************************/
184 int E_(FrontendOpen)( access_t * );
185 void E_(FrontendPoll)( access_t *p_access );
186 int E_(FrontendSet)( access_t * );
187 void E_(FrontendClose)( access_t * );
189 void E_(FrontendStatus)( access_t * );
192 int E_(DMXSetFilter)( access_t *, int i_pid, int * pi_fd, int i_type );
193 int E_(DMXUnsetFilter)( access_t *, int i_fd );
195 int E_(DVROpen)( access_t * );
196 void E_(DVRClose)( access_t * );
198 int E_(CAMOpen)( access_t * );
199 int E_(CAMPoll)( access_t * );
200 int E_(CAMSet)( access_t *, dvbpsi_pmt_t * );
201 void E_(CAMClose)( access_t * );
203 void E_(CAMStatus)( access_t * );
206 int E_(en50221_Init)( access_t * );
207 int E_(en50221_Poll)( access_t * );
208 int E_(en50221_SetCAPMT)( access_t *, dvbpsi_pmt_t * );
209 int E_(en50221_OpenMMI)( access_t * p_access, int i_slot );
210 int E_(en50221_CloseMMI)( access_t * p_access, int i_slot );
211 en50221_mmi_object_t *E_(en50221_GetMMIObject)( access_t * p_access,
213 void E_(en50221_SendMMIObject)( access_t * p_access, int i_slot,
214 en50221_mmi_object_t *p_object );
215 void E_(en50221_End)( access_t * );
218 int E_(HTTPOpen)( access_t *p_access );
219 void E_(HTTPClose)( access_t *p_access );
220 char *E_(HTTPExtractValue)( char *psz_uri, const char *psz_name,
221 char *psz_value, int i_value_max );