DVB: privatize scan_service
[vlc.git] / 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 _DVBPSI_DR_43_H_
25 #   define DVBPSI_USE_NIT 1
26 #   include <dvbpsi/nit.h>
27 #endif
28
29 #ifndef DVBPSI_USE_NIT
30 #   warning NIT is not supported by your libdvbpsi version
31 #endif
32
33 typedef enum
34 {
35     SCAN_NONE,
36     SCAN_DVB_T,
37     SCAN_DVB_S,
38     SCAN_DVB_C,
39 } scan_type_t;
40
41 typedef struct
42 {
43     int i_frequency;
44     int i_symbol_rate;
45     int i_fec;
46     char c_polarization;
47 } scan_dvbs_transponder_t;
48
49 struct scan_parameter_t
50 {
51     scan_type_t type;
52     bool b_exhaustive;
53     bool b_use_nit;
54     bool b_free_only;
55
56     struct
57     {
58         int i_min;
59         int i_max;
60         int i_step;
61
62         int i_count;    /* Number of frequency test to do */
63     } frequency;
64
65     struct
66     {
67         /* Bandwidth should be 6, 7 or 8 */
68         int i_min;
69         int i_max;
70         int i_step;
71
72         int i_count;
73     } bandwidth;
74
75     struct
76     {
77         char *psz_name;         /* satellite name */
78         char *psz_path;         /* config file path */
79
80         scan_dvbs_transponder_t *p_transponders;
81         int i_count;
82     } sat_info;
83 };
84
85 typedef struct
86 {
87     int i_frequency;
88     union
89     {
90         int i_bandwidth;
91         int i_symbol_rate;
92     };
93     int i_fec;
94     char c_polarization;
95 } scan_configuration_t;
96
97 typedef struct
98 {
99     vlc_object_t *p_obj;
100
101     scan_configuration_t cfg;
102     int i_snr;
103
104     dvbpsi_handle pat;
105     dvbpsi_pat_t *p_pat;
106     int i_nit_pid;
107
108     dvbpsi_handle sdt;
109     dvbpsi_sdt_t *p_sdt;
110
111 #ifdef DVBPSI_USE_NIT
112     dvbpsi_handle nit;
113     dvbpsi_nit_t *p_nit;
114 #endif
115
116 } scan_session_t;
117
118 scan_t *scan_New( vlc_object_t *p_obj, const scan_parameter_t *p_parameter );
119 void scan_Destroy( scan_t *p_scan );
120
121 int scan_Next( scan_t *p_scan, scan_configuration_t *p_cfg );
122
123 block_t *scan_GetM3U( scan_t *p_scan );
124 bool scan_IsCancelled( scan_t *p_scan );
125
126 int  scan_session_Init( vlc_object_t *p_obj, scan_session_t *p_session, const scan_configuration_t *p_cfg );
127 void scan_session_Clean( scan_t *p_scan, scan_session_t *p_session );
128 bool scan_session_Push( scan_session_t *p_scan, block_t *p_block );
129 void scan_service_SetSNR( scan_session_t *p_scan, int i_snr );
130