]> git.sesse.net Git - vlc/blob - modules/access/dvb/dvb.h
DVB: separate CA management
[vlc] / modules / access / dvb / dvb.h
1 /*****************************************************************************
2  * dvb.h : functions to control a DVB card under Linux with v4l2
3  *****************************************************************************
4  * Copyright (C) 1998-2005 the VideoLAN team
5  *
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>
10  *
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.
15  *
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.
20  *
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  *****************************************************************************/
25
26 /*****************************************************************************
27  * Local structures
28  *****************************************************************************/
29 typedef struct demux_handle_t
30 {
31     int i_pid;
32     int i_handle;
33     int i_type;
34 } demux_handle_t;
35
36 typedef struct frontend_t frontend_t;
37 typedef struct
38 {
39     int i_snr;              /**< Signal Noise ratio */
40     int i_ber;              /**< Bitrate error ratio */
41     int i_signal_strenth;   /**< Signal strength */
42 } frontend_statistic_t;
43
44 typedef struct
45 {
46     bool b_has_signal;
47     bool b_has_carrier;
48     bool b_has_lock;
49 } frontend_status_t;
50
51 typedef struct scan_parameter_t scan_parameter_t;
52 typedef struct scan_t scan_t;
53
54 #define MAX_DEMUX 256
55
56 #include "en50221.h"
57
58 struct access_sys_t
59 {
60     int i_handle, i_frontend_handle;
61     demux_handle_t p_demux_handles[MAX_DEMUX];
62     frontend_t *p_frontend;
63     mtime_t i_frontend_timeout;
64     bool b_budget_mode;
65
66     cam_t cam;
67
68     /* */
69     int i_read_once;
70
71     int i_stat_counter;
72
73 #ifdef ENABLE_HTTPD
74     /* Local HTTP server */
75     httpd_host_t        *p_httpd_host;
76     httpd_file_sys_t    *p_httpd_file;
77     httpd_redirect_t    *p_httpd_redir;
78
79     vlc_mutex_t         httpd_mutex;
80     vlc_cond_t          httpd_cond;
81     mtime_t             i_httpd_timeout;
82     bool                b_request_frontend_info, b_request_mmi_info;
83     char                *psz_frontend_info, *psz_mmi_info;
84     char                *psz_request;
85 #endif
86
87     /* Scan */
88     scan_t *scan;
89 };
90
91 #define VIDEO0_TYPE     1
92 #define AUDIO0_TYPE     2
93 #define TELETEXT0_TYPE  3
94 #define SUBTITLE0_TYPE  4
95 #define PCR0_TYPE       5
96 #define TYPE_INTERVAL   5
97 #define OTHER_TYPE     21
98
99 /*****************************************************************************
100  * Prototypes
101  *****************************************************************************/
102
103 int  FrontendOpen( access_t * );
104 void FrontendPoll( access_t *p_access );
105 int  FrontendSet( access_t * );
106 void FrontendClose( access_t * );
107 #ifdef ENABLE_HTTPD
108 void FrontendStatus( access_t * );
109 #endif
110
111 int  FrontendGetStatistic( access_t *, frontend_statistic_t * );
112 void FrontendGetStatus( access_t *, frontend_status_t * );
113 int  FrontendGetScanParameter( access_t *, scan_parameter_t * );
114
115 int DMXSetFilter( access_t *, int i_pid, int * pi_fd, int i_type );
116 int DMXUnsetFilter( access_t *, int i_fd );
117
118 int  DVROpen( access_t * );
119 void DVRClose( access_t * );
120
121 int  CAMOpen( access_t * );
122 int  CAMPoll( access_t * );
123 int  CAMSet( access_t *, dvbpsi_pmt_t * );
124 void CAMClose( access_t * );
125 #ifdef ENABLE_HTTPD
126 void CAMStatus( access_t * );
127 #endif
128
129 #ifdef ENABLE_HTTPD
130 int HTTPOpen( access_t *p_access );
131 void HTTPClose( access_t *p_access );
132 const char *HTTPExtractValue( const char *psz_uri, const char *psz_name,
133                               char *psz_value, int i_value_max );
134 #endif
135 /*****************************************************************************
136  * Hacks
137  *****************************************************************************/
138 #define STRINGIFY( z )   UGLY_KLUDGE( z )
139 #define UGLY_KLUDGE( z ) #z
140