]> git.sesse.net Git - vlc/blobdiff - modules/access/dvb/dvb.h
* modules/access/dvb: Full support for DVB MMI menus via an optional HTTP
[vlc] / modules / access / dvb / dvb.h
index bcf1f92070c2e584dac8c5ec936c290193ac88be..f8e089feaee6b91c346f7a2df370bf2b4f5c6fbe 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * dvb.h : functions to control a DVB card under Linux with v4l2
  *****************************************************************************
- * Copyright (C) 1998-2004 the VideoLAN team
+ * Copyright (C) 1998-2005 the VideoLAN team
  *
  * Authors: Johan Bilien <jobi@via.ecp.fr>
  *          Jean-Paul Saman <jpsaman@saman>
@@ -35,7 +35,7 @@
 /*****************************************************************************
  * Local structures
  *****************************************************************************/
-typedef struct
+typedef struct demux_handle_t
 {
     int i_pid;
     int i_handle;
@@ -44,7 +44,7 @@ typedef struct
 
 typedef struct frontend_t frontend_t;
 
-typedef struct
+typedef struct en50221_session_t
 {
     int i_slot;
     int i_resource_id;
@@ -54,6 +54,84 @@ typedef struct
     void *p_sys;
 } en50221_session_t;
 
+#define EN50221_MMI_NONE 0
+#define EN50221_MMI_ENQ 1
+#define EN50221_MMI_ANSW 2
+#define EN50221_MMI_MENU 3
+#define EN50221_MMI_MENU_ANSW 4
+#define EN50221_MMI_LIST 5
+
+typedef struct en50221_mmi_object_t
+{
+    int i_object_type;
+
+    union
+    {
+        struct
+        {
+            vlc_bool_t b_blind;
+            char *psz_text;
+        } enq;
+
+        struct
+        {
+            vlc_bool_t b_ok;
+            char *psz_answ;
+        } answ;
+
+        struct
+        {
+            char *psz_title, *psz_subtitle, *psz_bottom;
+            char **ppsz_choices;
+            int i_choices;
+        } menu; /* menu and list are the same */
+
+        struct
+        {
+            int i_choice;
+        } menu_answ;
+    } u;
+} en50221_mmi_object_t;
+
+static __inline__ void en50221_MMIFree( en50221_mmi_object_t *p_object )
+{
+    int i;
+
+#define FREE( x )                                                           \
+    if ( x != NULL )                                                        \
+        free( x );
+
+    switch ( p_object->i_object_type )
+    {
+    case EN50221_MMI_ENQ:
+        FREE( p_object->u.enq.psz_text );
+        break;
+
+    case EN50221_MMI_ANSW:
+        if ( p_object->u.answ.b_ok )
+        {
+            FREE( p_object->u.answ.psz_answ );
+        }
+        break;
+
+    case EN50221_MMI_MENU:
+    case EN50221_MMI_LIST:
+        FREE( p_object->u.menu.psz_title );
+        FREE( p_object->u.menu.psz_subtitle );
+        FREE( p_object->u.menu.psz_bottom );
+        for ( i = 0; i < p_object->u.menu.i_choices; i++ )
+        {
+            FREE( p_object->u.menu.ppsz_choices[i] );
+        }
+        FREE( p_object->u.menu.ppsz_choices );
+        break;
+
+    default:
+        break;
+    }
+#undef FREE
+}
+
 #define MAX_DEMUX 256
 #define MAX_CI_SLOTS 16
 #define MAX_SESSIONS 32
@@ -72,6 +150,8 @@ struct access_sys_t
     int i_nb_slots;
     vlc_bool_t pb_active_slot[MAX_CI_SLOTS];
     vlc_bool_t pb_tc_has_data[MAX_CI_SLOTS];
+    vlc_bool_t pb_slot_mmi_expected[MAX_CI_SLOTS];
+    vlc_bool_t pb_slot_mmi_undisplayed[MAX_CI_SLOTS];
     en50221_session_t p_sessions[MAX_SESSIONS];
     mtime_t i_ca_timeout, i_ca_next_event, i_frontend_timeout;
     dvbpsi_pmt_t *pp_selected_programs[MAX_PROGRAMS];
@@ -79,6 +159,20 @@ struct access_sys_t
 
     /* */
     int i_read_once;
+
+#ifdef ENABLE_HTTPD
+    /* Local HTTP server */
+    httpd_host_t        *p_httpd_host;
+    httpd_file_sys_t    *p_httpd_file;
+    httpd_redirect_t    *p_httpd_redir;
+
+    vlc_mutex_t         httpd_mutex;
+    vlc_cond_t          httpd_cond;
+    mtime_t             i_httpd_timeout;
+    vlc_bool_t          b_request_frontend_info, b_request_mmi_info;
+    char                *psz_frontend_info, *psz_mmi_info;
+    char                *psz_request;
+#endif
 };
 
 #define VIDEO0_TYPE     1
@@ -96,6 +190,9 @@ int  E_(FrontendOpen)( access_t * );
 void E_(FrontendPoll)( access_t *p_access );
 int  E_(FrontendSet)( access_t * );
 void E_(FrontendClose)( access_t * );
+#ifdef ENABLE_HTTPD
+void E_(FrontendStatus)( access_t * );
+#endif
 
 int E_(DMXSetFilter)( access_t *, int i_pid, int * pi_fd, int i_type );
 int E_(DMXUnsetFilter)( access_t *, int i_fd );
@@ -107,9 +204,25 @@ int  E_(CAMOpen)( access_t * );
 int  E_(CAMPoll)( access_t * );
 int  E_(CAMSet)( access_t *, dvbpsi_pmt_t * );
 void E_(CAMClose)( access_t * );
+#ifdef ENABLE_HTTPD
+void E_(CAMStatus)( access_t * );
+#endif
 
 int E_(en50221_Init)( access_t * );
 int E_(en50221_Poll)( access_t * );
 int E_(en50221_SetCAPMT)( access_t *, dvbpsi_pmt_t * );
+int E_(en50221_OpenMMI)( access_t * p_access, int i_slot );
+int E_(en50221_CloseMMI)( access_t * p_access, int i_slot );
+en50221_mmi_object_t *E_(en50221_GetMMIObject)( access_t * p_access,
+                                                int i_slot );
+void E_(en50221_SendMMIObject)( access_t * p_access, int i_slot,
+                                en50221_mmi_object_t *p_object );
 void E_(en50221_End)( access_t * );
 
+#ifdef ENABLE_HTTPD
+int E_(HTTPOpen)( access_t *p_access );
+void E_(HTTPClose)( access_t *p_access );
+char *E_(HTTPExtractValue)( char *psz_uri, const char *psz_name,
+                            char *psz_value, int i_value_max );
+#endif
+