c3d0ea03d114de2f38a1001d47736d80a8f8e063
[vlc.git] / modules / access / dvb / scan.h
1 /*****************************************************************************
2  * scan.h : functions to ease DVB scanning
3  *****************************************************************************
4  * Copyright (C) 2008 the VideoLAN team
5  *
6  * Authors: Laurent Aimar <fenrir@videolan.org>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.    See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA    02111, USA.
21  *****************************************************************************/
22
23 typedef enum
24 {
25     SCAN_NONE,
26     SCAN_DVB_T,
27     SCAN_DVB_S,
28     SCAN_DVB_C,
29 } scan_type_t;
30
31 typedef struct
32 {
33     scan_type_t type;
34     bool b_exhaustive;
35     struct
36     {
37         int i_min;
38         int i_max;
39         int i_step;
40
41         int i_count;    /* Number of frequency test to do */
42     } frequency;
43
44     struct
45     {
46         /* Bandwidth should be 6, 7 or 8 */
47         int i_min;
48         int i_max;
49         int i_step;
50
51         int i_count;
52     } bandwidth;
53
54 } scan_parameter_t;
55
56 typedef struct
57 {
58     int i_frequency;
59     int i_bandwidth;
60 } scan_configuration_t;
61
62 typedef enum
63 {
64     SERVICE_UNKNOWN = 0,
65     SERVICE_DIGITAL_RADIO,
66     SERVICE_DIGITAL_TELEVISION,
67     SERVICE_DIGITAL_TELEVISION_AC_SD,
68     SERVICE_DIGITAL_TELEVISION_AC_HD,
69 } scan_service_type_t;
70
71 typedef struct
72 {
73     int  i_program;     /* program number (service id) */
74     scan_configuration_t cfg;
75     int i_snr;
76
77     scan_service_type_t type;
78     char *psz_name;     /* channel name in utf8 or NULL */
79     int  i_channel;     /* -1 if unknown */
80     bool b_crypted;     /* True if potentially crypted */
81
82
83     int i_network_id;
84
85     int i_nit_version;
86     int i_sdt_version;
87
88 } scan_service_t;
89
90 typedef struct
91 {
92     vlc_object_t *p_obj;
93
94     scan_configuration_t cfg;
95     int i_snr;
96
97     dvbpsi_handle pat;
98     dvbpsi_pat_t *p_pat;
99     int i_nit_pid;
100
101     dvbpsi_handle sdt;
102     dvbpsi_sdt_t *p_sdt;
103
104     dvbpsi_handle nit;
105     dvbpsi_nit_t *p_nit;
106
107 } scan_session_t;
108
109 typedef struct
110 {
111     vlc_object_t *p_obj;
112     int64_t i_index;
113     int i_dialog_id;
114     scan_parameter_t parameter;
115     int64_t i_time_start;
116
117     int            i_service;
118     scan_service_t **pp_service;
119 } scan_t;
120
121
122 scan_service_t *scan_service_New( int i_program, const scan_configuration_t *p_cfg  );
123 void scan_service_Delete( scan_service_t *p_srv );
124
125 int  scan_Init( vlc_object_t *p_obj, scan_t *p_scan, const scan_parameter_t *p_parameter );
126 void scan_Clean( scan_t *p_scan );
127
128 int scan_Next( scan_t *p_scan, scan_configuration_t *p_cfg );
129
130 block_t *scan_GetM3U( scan_t *p_scan );
131 bool scan_IsCancelled( scan_t *p_scan );
132
133 int  scan_session_Init( vlc_object_t *p_obj, scan_session_t *p_session, const scan_configuration_t *p_cfg );
134 void scan_session_Clean( scan_t *p_scan, scan_session_t *p_session );
135 bool scan_session_Push( scan_session_t *p_scan, block_t *p_block );
136 void scan_service_SetSNR( scan_session_t *p_scan, int i_snr );
137