dc5ce7ac77274d0046f1541b15a875143a4fc115
[vlc.git] / modules / access / dvb / scan.h
1 /*****************************************************************************
2  * scan.h : functions to ease DVB scanning
3  *****************************************************************************
4  * Copyright (C) 2008,2010 VLC authors and VideoLAN
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 it
10  * under the terms of the GNU Lesser General Public License as published by
11  * the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public License
20  * along with this program; if not, write to the Free Software Foundation,
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA    02111, USA.
22  *****************************************************************************/
23
24 typedef enum
25 {
26     SCAN_NONE = 0,
27     SCAN_DVB_T,
28     SCAN_DVB_S,
29     SCAN_DVB_C,
30 } scan_type_t;
31
32 typedef struct
33 {
34     unsigned i_frequency;
35     union
36     {
37         unsigned i_bandwidth;
38         unsigned i_symbolrate;
39     };
40     int i_fec;
41     int i_modulation;
42     char c_polarization;
43
44 } scan_tuner_config_t;
45
46 typedef struct scan_parameter_t
47 {
48     scan_type_t type;
49     bool b_exhaustive;
50     bool b_use_nit;
51     bool b_free_only;
52     bool b_modulation_set;
53     bool b_symbolrate_set;
54
55     int i_modulation;
56     int i_symbolrate;
57     struct
58     {
59         unsigned i_min;
60         unsigned i_max;
61         unsigned i_step;
62
63         unsigned i_count;    /* Number of frequency test to do */
64     } frequency,
65       bandwidth; /* Bandwidth should be 6, 7 or 8 */
66
67     char *psz_scanlist_file;
68     enum
69     {
70         FORMAT_DVBv3,
71         FORMAT_DVBv5,
72     } scanlist_format;
73
74 } scan_parameter_t;
75
76 typedef struct scan_t scan_t;
77
78 void scan_parameter_Init( scan_parameter_t * );
79 void scan_parameter_Clean( scan_parameter_t * );
80
81 scan_t *scan_New( vlc_object_t *p_obj, const scan_parameter_t *p_parameter );
82 void scan_Destroy( scan_t *p_scan );
83
84 int scan_Next( scan_t *p_scan, scan_tuner_config_t *p_cfg );
85
86 block_t *scan_GetM3U( scan_t *p_scan );
87 bool scan_IsCancelled( scan_t *p_scan );
88
89 typedef struct scan_session_t scan_session_t;
90
91 scan_session_t *scan_session_New( scan_t *, const scan_tuner_config_t * );
92 void scan_session_Destroy( scan_t *, scan_session_t * );
93 bool scan_session_Push( scan_session_t *p_scan, const uint8_t * );
94 void scan_session_SetSNR( scan_session_t *p_scan, int i_snr );
95 unsigned scan_session_GetTablesTimeout( const scan_session_t * );