access_dvb: constify.
[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 #ifdef HAVE_DVBPSI_DR_H
24 #ifdef _DVBPSI_DR_43_H_
25 #   define DVBPSI_USE_NIT 1
26 #   include <dvbpsi/nit.h>
27 #endif
28 #else
29 #ifdef _DVBPSI_DR_43_H_
30 #   define DVBPSI_USE_NIT 1
31 #   include "nit.h"
32 #endif
33 #endif
34
35 #ifndef DVBPSI_USE_NIT
36 #   warning NIT is not supported by your libdvbpsi version
37 #endif
38
39 typedef enum
40 {
41     SCAN_NONE,
42     SCAN_DVB_T,
43     SCAN_DVB_S,
44     SCAN_DVB_C,
45 } scan_type_t;
46
47 typedef struct
48 {
49     scan_type_t type;
50     bool b_exhaustive;
51     struct
52     {
53         int i_min;
54         int i_max;
55         int i_step;
56
57         int i_count;    /* Number of frequency test to do */
58     } frequency;
59
60     struct
61     {
62         /* Bandwidth should be 6, 7 or 8 */
63         int i_min;
64         int i_max;
65         int i_step;
66
67         int i_count;
68     } bandwidth;
69
70 } scan_parameter_t;
71
72 typedef struct
73 {
74     int i_frequency;
75     int i_bandwidth;
76 } scan_configuration_t;
77
78 typedef enum
79 {
80     SERVICE_UNKNOWN = 0,
81     SERVICE_DIGITAL_RADIO,
82     SERVICE_DIGITAL_TELEVISION,
83     SERVICE_DIGITAL_TELEVISION_AC_SD,
84     SERVICE_DIGITAL_TELEVISION_AC_HD,
85 } scan_service_type_t;
86
87 typedef struct
88 {
89     int  i_program;     /* program number (service id) */
90     scan_configuration_t cfg;
91     int i_snr;
92
93     scan_service_type_t type;
94     char *psz_name;     /* channel name in utf8 or NULL */
95     int  i_channel;     /* -1 if unknown */
96     bool b_crypted;     /* True if potentially crypted */
97
98
99     int i_network_id;
100
101     int i_nit_version;
102     int i_sdt_version;
103
104 } scan_service_t;
105
106 typedef struct
107 {
108     vlc_object_t *p_obj;
109
110     scan_configuration_t cfg;
111     int i_snr;
112
113     dvbpsi_handle pat;
114     dvbpsi_pat_t *p_pat;
115     int i_nit_pid;
116
117     dvbpsi_handle sdt;
118     dvbpsi_sdt_t *p_sdt;
119
120 #ifdef DVBPSI_USE_NIT
121     dvbpsi_handle nit;
122     dvbpsi_nit_t *p_nit;
123 #endif
124
125 } scan_session_t;
126
127 typedef struct
128 {
129     vlc_object_t *p_obj;
130     struct dialog_progress_bar_t *p_dialog;
131     int64_t i_index;
132     scan_parameter_t parameter;
133     int64_t i_time_start;
134
135     int            i_service;
136     scan_service_t **pp_service;
137 } scan_t;
138
139
140 scan_service_t *scan_service_New( int i_program, const scan_configuration_t *p_cfg  );
141 void scan_service_Delete( scan_service_t *p_srv );
142
143 int  scan_Init( vlc_object_t *p_obj, scan_t *p_scan, const scan_parameter_t *p_parameter );
144 void scan_Clean( scan_t *p_scan );
145
146 int scan_Next( scan_t *p_scan, scan_configuration_t *p_cfg );
147
148 block_t *scan_GetM3U( scan_t *p_scan );
149 bool scan_IsCancelled( scan_t *p_scan );
150
151 int  scan_session_Init( vlc_object_t *p_obj, scan_session_t *p_session, const scan_configuration_t *p_cfg );
152 void scan_session_Clean( scan_t *p_scan, scan_session_t *p_session );
153 bool scan_session_Push( scan_session_t *p_scan, block_t *p_block );
154 void scan_service_SetSNR( scan_session_t *p_scan, int i_snr );
155