]> git.sesse.net Git - vlc/blob - modules/access/dvb/scan.h
Update LGPL license blurb, choosing v2.1+.
[vlc] / modules / access / dvb / scan.h
1 /*****************************************************************************
2  * scan.h : functions to ease DVB scanning
3  *****************************************************************************
4  * Copyright (C) 2008,2010 the VideoLAN team
5  *
6  * Authors: Laurent Aimar <fenrir@videolan.org>
7  *          David Kaplan <david@2of1.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.    See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA    02111, USA.
22  *****************************************************************************/
23
24 #ifdef HAVE_DVBPSI_DR_H
25 #ifdef _DVBPSI_DR_43_H_
26 #   define DVBPSI_USE_NIT 1
27 #   include <dvbpsi/nit.h>
28 #endif
29 #else
30 #ifdef _DVBPSI_DR_43_H_
31 #   define DVBPSI_USE_NIT 1
32 #   include "nit.h"
33 #endif
34 #endif
35
36 #ifndef DVBPSI_USE_NIT
37 #   warning NIT is not supported by your libdvbpsi version
38 #endif
39
40 typedef enum
41 {
42     SCAN_NONE,
43     SCAN_DVB_T,
44     SCAN_DVB_S,
45     SCAN_DVB_C,
46 } scan_type_t;
47
48 typedef struct
49 {
50     int i_frequency;
51     int i_symbol_rate;
52     int i_fec;
53     char c_polarization;
54 } scan_dvbs_transponder_t;
55
56 typedef struct
57 {
58     scan_type_t type;
59     bool b_exhaustive;
60     bool b_use_nit;
61     bool b_free_only;
62
63     struct
64     {
65         int i_min;
66         int i_max;
67         int i_step;
68
69         int i_count;    /* Number of frequency test to do */
70     } frequency;
71
72     struct
73     {
74         /* Bandwidth should be 6, 7 or 8 */
75         int i_min;
76         int i_max;
77         int i_step;
78
79         int i_count;
80     } bandwidth;
81
82     struct
83     {
84         char *psz_name;         /* satellite name */
85         char *psz_path;         /* config file path */
86
87         scan_dvbs_transponder_t *p_transponders;
88         int i_count;
89     } sat_info;
90
91 } scan_parameter_t;
92
93 typedef struct
94 {
95     int i_frequency;
96     union
97     {
98         int i_bandwidth;
99         int i_symbol_rate;
100     };
101     int i_fec;
102     char c_polarization;
103 } scan_configuration_t;
104
105 typedef enum
106 {
107     SERVICE_UNKNOWN = 0,
108     SERVICE_DIGITAL_RADIO,
109     SERVICE_DIGITAL_TELEVISION,
110     SERVICE_DIGITAL_TELEVISION_AC_SD,
111     SERVICE_DIGITAL_TELEVISION_AC_HD,
112 } scan_service_type_t;
113
114 typedef struct
115 {
116     int  i_program;     /* program number (service id) */
117     scan_configuration_t cfg;
118     int i_snr;
119
120     scan_service_type_t type;
121     char *psz_name;     /* channel name in utf8 or NULL */
122     int  i_channel;     /* -1 if unknown */
123     bool b_crypted;     /* True if potentially crypted */
124
125     int i_network_id;
126
127     int i_nit_version;
128     int i_sdt_version;
129
130 } scan_service_t;
131
132 typedef struct
133 {
134     vlc_object_t *p_obj;
135
136     scan_configuration_t cfg;
137     int i_snr;
138
139     dvbpsi_handle pat;
140     dvbpsi_pat_t *p_pat;
141     int i_nit_pid;
142
143     dvbpsi_handle sdt;
144     dvbpsi_sdt_t *p_sdt;
145
146 #ifdef DVBPSI_USE_NIT
147     dvbpsi_handle nit;
148     dvbpsi_nit_t *p_nit;
149 #endif
150
151 } scan_session_t;
152
153 typedef struct
154 {
155     vlc_object_t *p_obj;
156     struct dialog_progress_bar_t *p_dialog;
157     int64_t i_index;
158     scan_parameter_t parameter;
159     int64_t i_time_start;
160
161     int            i_service;
162     scan_service_t **pp_service;
163 } scan_t;
164
165
166 scan_service_t *scan_service_New( int i_program, const scan_configuration_t *p_cfg  );
167 void scan_service_Delete( scan_service_t *p_srv );
168
169 int  scan_Init( vlc_object_t *p_obj, scan_t *p_scan, const scan_parameter_t *p_parameter );
170 void scan_Clean( scan_t *p_scan );
171
172 int scan_Next( scan_t *p_scan, scan_configuration_t *p_cfg );
173
174 block_t *scan_GetM3U( scan_t *p_scan );
175 bool scan_IsCancelled( scan_t *p_scan );
176
177 int  scan_session_Init( vlc_object_t *p_obj, scan_session_t *p_session, const scan_configuration_t *p_cfg );
178 void scan_session_Clean( scan_t *p_scan, scan_session_t *p_session );
179 bool scan_session_Push( scan_session_t *p_scan, block_t *p_block );
180 void scan_service_SetSNR( scan_session_t *p_scan, int i_snr );
181