Mercurial > mplayer.hg
annotate stream/dvb_tune.c @ 27852:bebb8b79aa6b
synced with r27885
author | Gabrov |
---|---|
date | Mon, 03 Nov 2008 12:06:40 +0000 |
parents | 187ca29cd878 |
children | 6aeb7cc0bba2 |
rev | line source |
---|---|
9610 | 1 /* dvbtune - tune.c |
2 | |
3 Copyright (C) Dave Chapman 2001,2002 | |
4 | |
18783 | 5 Modified for use with MPlayer, for details see the changelog at |
6 http://svn.mplayerhq.hu/mplayer/trunk/ | |
15178
8dd7a656eaf8
Mark modified imported files as such to comply more closely with GPL ¡ø2a.
diego
parents:
14382
diff
changeset
|
7 $Id$ |
8dd7a656eaf8
Mark modified imported files as such to comply more closely with GPL ¡ø2a.
diego
parents:
14382
diff
changeset
|
8 |
9610 | 9 This program is free software; you can redistribute it and/or |
10 modify it under the terms of the GNU General Public License | |
11 as published by the Free Software Foundation; either version 2 | |
12 of the License, or (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-1307, USA. | |
22 Or, point your browser to http://www.gnu.org/copyleft/gpl.html | |
23 | |
24 */ | |
25 | |
26 #include <stdio.h> | |
27 #include <stdlib.h> | |
28 #include <ctype.h> | |
29 #include <sys/ioctl.h> | |
27431
bb738b9ea7c4
Use '#include <poll.h>' instead of '#include <sys/poll.h>'.
diego
parents:
27370
diff
changeset
|
30 #include <poll.h> |
9610 | 31 #include <unistd.h> |
32 #include <fcntl.h> | |
14282
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
33 #include <time.h> |
10560 | 34 #include <errno.h> |
9610 | 35 #include "config.h" |
36 | |
27370
14c5017f40d2
Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents:
26401
diff
changeset
|
37 #ifdef CONFIG_DVB_HEAD |
9610 | 38 #include <linux/dvb/dmx.h> |
39 #include <linux/dvb/frontend.h> | |
40 #else | |
41 #include <ost/dmx.h> | |
42 #include <ost/sec.h> | |
43 #include <ost/frontend.h> | |
44 #endif | |
45 | |
46 #include "dvbin.h" | |
17012 | 47 #include "mp_msg.h" |
9610 | 48 |
49 | |
50 | |
12309 | 51 int dvb_get_tuner_type(int fe_fd) |
9610 | 52 { |
27370
14c5017f40d2
Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents:
26401
diff
changeset
|
53 #ifdef CONFIG_DVB_HEAD |
10560 | 54 struct dvb_frontend_info fe_info; |
55 #else | |
56 FrontendInfo fe_info; | |
57 #endif | |
58 | |
12309 | 59 int res; |
11872
d158978a3d3c
Compliance with the DVB power management specification (doesn't close
attila
parents:
11352
diff
changeset
|
60 |
10560 | 61 res = ioctl(fe_fd, FE_GET_INFO, &fe_info); |
62 if(res < 0) | |
63 { | |
64 mp_msg(MSGT_DEMUX, MSGL_ERR, "FE_GET_INFO error: %d, FD: %d\n\n", errno, fe_fd); | |
65 return 0; | |
66 } | |
67 | |
68 switch(fe_info.type) | |
69 { | |
70 case FE_OFDM: | |
12309 | 71 mp_msg(MSGT_DEMUX, MSGL_V, "TUNER TYPE SEEMS TO BE DVB-T\n"); |
10560 | 72 return TUNER_TER; |
73 | |
74 case FE_QPSK: | |
12309 | 75 mp_msg(MSGT_DEMUX, MSGL_V, "TUNER TYPE SEEMS TO BE DVB-S\n"); |
10560 | 76 return TUNER_SAT; |
11872
d158978a3d3c
Compliance with the DVB power management specification (doesn't close
attila
parents:
11352
diff
changeset
|
77 |
10560 | 78 case FE_QAM: |
12309 | 79 mp_msg(MSGT_DEMUX, MSGL_V, "TUNER TYPE SEEMS TO BE DVB-C\n"); |
10560 | 80 return TUNER_CBL; |
11872
d158978a3d3c
Compliance with the DVB power management specification (doesn't close
attila
parents:
11352
diff
changeset
|
81 |
14382 | 82 #ifdef DVB_ATSC |
83 case FE_ATSC: | |
84 mp_msg(MSGT_DEMUX, MSGL_V, "TUNER TYPE SEEMS TO BE DVB-ATSC\n"); | |
85 return TUNER_ATSC; | |
86 #endif | |
10560 | 87 default: |
88 mp_msg(MSGT_DEMUX, MSGL_ERR, "UNKNOWN TUNER TYPE\n"); | |
11872
d158978a3d3c
Compliance with the DVB power management specification (doesn't close
attila
parents:
11352
diff
changeset
|
89 return 0; |
10560 | 90 } |
11872
d158978a3d3c
Compliance with the DVB power management specification (doesn't close
attila
parents:
11352
diff
changeset
|
91 |
d158978a3d3c
Compliance with the DVB power management specification (doesn't close
attila
parents:
11352
diff
changeset
|
92 } |
10560 | 93 |
12803
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
94 int dvb_set_ts_filt(int fd, uint16_t pid, dmx_pes_type_t pestype); |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
95 |
24875 | 96 int dvb_open_devices(dvb_priv_t *priv, int n, int demux_cnt) |
10560 | 97 { |
12803
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
98 int i; |
27786
187ca29cd878
Conditionally declare a conditionally used variable, fixes the warning:
diego
parents:
27431
diff
changeset
|
99 char frontend_dev[32], dvr_dev[32], demux_dev[32]; |
187ca29cd878
Conditionally declare a conditionally used variable, fixes the warning:
diego
parents:
27431
diff
changeset
|
100 #ifndef CONFIG_DVB_HEAD |
187ca29cd878
Conditionally declare a conditionally used variable, fixes the warning:
diego
parents:
27431
diff
changeset
|
101 char sec_dev[32]; |
187ca29cd878
Conditionally declare a conditionally used variable, fixes the warning:
diego
parents:
27431
diff
changeset
|
102 #endif |
26401
617754f47828
in preparation for multi-frontend patch replaced file-static device names with sprintf() calls in 2 functions
nicodvb
parents:
25694
diff
changeset
|
103 |
27370
14c5017f40d2
Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents:
26401
diff
changeset
|
104 #ifdef CONFIG_DVB_HEAD |
26401
617754f47828
in preparation for multi-frontend patch replaced file-static device names with sprintf() calls in 2 functions
nicodvb
parents:
25694
diff
changeset
|
105 sprintf(frontend_dev, "/dev/dvb/adapter%d/frontend0", n); |
617754f47828
in preparation for multi-frontend patch replaced file-static device names with sprintf() calls in 2 functions
nicodvb
parents:
25694
diff
changeset
|
106 sprintf(dvr_dev, "/dev/dvb/adapter%d/dvr0", n); |
617754f47828
in preparation for multi-frontend patch replaced file-static device names with sprintf() calls in 2 functions
nicodvb
parents:
25694
diff
changeset
|
107 sprintf(demux_dev, "/dev/dvb/adapter%d/demux0", n); |
617754f47828
in preparation for multi-frontend patch replaced file-static device names with sprintf() calls in 2 functions
nicodvb
parents:
25694
diff
changeset
|
108 #else |
617754f47828
in preparation for multi-frontend patch replaced file-static device names with sprintf() calls in 2 functions
nicodvb
parents:
25694
diff
changeset
|
109 sprintf(frontend_dev, "/dev/ost/frontend%d", n); |
617754f47828
in preparation for multi-frontend patch replaced file-static device names with sprintf() calls in 2 functions
nicodvb
parents:
25694
diff
changeset
|
110 sprintf(dvr_dev, "/dev/ost/dvr%d", n); |
617754f47828
in preparation for multi-frontend patch replaced file-static device names with sprintf() calls in 2 functions
nicodvb
parents:
25694
diff
changeset
|
111 sprintf(demux_dev, "/dev/ost/demux%d", n); |
617754f47828
in preparation for multi-frontend patch replaced file-static device names with sprintf() calls in 2 functions
nicodvb
parents:
25694
diff
changeset
|
112 sprintf(sec_dev, "/dev/ost/sec%d", n); |
617754f47828
in preparation for multi-frontend patch replaced file-static device names with sprintf() calls in 2 functions
nicodvb
parents:
25694
diff
changeset
|
113 #endif |
617754f47828
in preparation for multi-frontend patch replaced file-static device names with sprintf() calls in 2 functions
nicodvb
parents:
25694
diff
changeset
|
114 priv->fe_fd = open(frontend_dev, O_RDWR | O_NONBLOCK); |
10560 | 115 if(priv->fe_fd < 0) |
9610 | 116 { |
26401
617754f47828
in preparation for multi-frontend patch replaced file-static device names with sprintf() calls in 2 functions
nicodvb
parents:
25694
diff
changeset
|
117 mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR OPENING FRONTEND DEVICE %s: ERRNO %d\n", frontend_dev, errno); |
10560 | 118 return 0; |
9610 | 119 } |
27370
14c5017f40d2
Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents:
26401
diff
changeset
|
120 #ifdef CONFIG_DVB_HEAD |
21777 | 121 priv->sec_fd=0; |
9610 | 122 #else |
26401
617754f47828
in preparation for multi-frontend patch replaced file-static device names with sprintf() calls in 2 functions
nicodvb
parents:
25694
diff
changeset
|
123 priv->sec_fd = open(sec_dev, O_RDWR); |
21777 | 124 if(priv->sec_fd < 0) |
125 { | |
26401
617754f47828
in preparation for multi-frontend patch replaced file-static device names with sprintf() calls in 2 functions
nicodvb
parents:
25694
diff
changeset
|
126 mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR OPENING SEC DEVICE %s: ERRNO %d\n", sec_dev, errno); |
10560 | 127 close(priv->fe_fd); |
21777 | 128 return 0; |
129 } | |
9610 | 130 #endif |
12803
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
131 priv->demux_fds_cnt = 0; |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
132 mp_msg(MSGT_DEMUX, MSGL_V, "DVB_OPEN_DEVICES(%d)\n", demux_cnt); |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
133 for(i = 0; i < demux_cnt; i++) |
12309 | 134 { |
26401
617754f47828
in preparation for multi-frontend patch replaced file-static device names with sprintf() calls in 2 functions
nicodvb
parents:
25694
diff
changeset
|
135 priv->demux_fds[i] = open(demux_dev, O_RDWR | O_NONBLOCK); |
12803
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
136 if(priv->demux_fds[i] < 0) |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
137 { |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
138 mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR OPENING DEMUX 0: %d\n", errno); |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
139 return 0; |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
140 } |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
141 else |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
142 { |
26401
617754f47828
in preparation for multi-frontend patch replaced file-static device names with sprintf() calls in 2 functions
nicodvb
parents:
25694
diff
changeset
|
143 mp_msg(MSGT_DEMUX, MSGL_V, "OPEN(%d), file %s: FD=%d, CNT=%d\n", i, demux_dev, priv->demux_fds[i], priv->demux_fds_cnt); |
12803
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
144 priv->demux_fds_cnt++; |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
145 } |
12309 | 146 } |
147 | |
148 | |
26401
617754f47828
in preparation for multi-frontend patch replaced file-static device names with sprintf() calls in 2 functions
nicodvb
parents:
25694
diff
changeset
|
149 priv->dvr_fd = open(dvr_dev, O_RDONLY| O_NONBLOCK); |
12309 | 150 if(priv->dvr_fd < 0) |
151 { | |
26401
617754f47828
in preparation for multi-frontend patch replaced file-static device names with sprintf() calls in 2 functions
nicodvb
parents:
25694
diff
changeset
|
152 mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR OPENING DVR DEVICE %s: %d\n", dvr_dev, errno); |
12309 | 153 return 0; |
154 } | |
10560 | 155 |
21777 | 156 return 1; |
9610 | 157 } |
158 | |
159 | |
24875 | 160 int dvb_fix_demuxes(dvb_priv_t *priv, int cnt) |
12803
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
161 { |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
162 int i; |
26401
617754f47828
in preparation for multi-frontend patch replaced file-static device names with sprintf() calls in 2 functions
nicodvb
parents:
25694
diff
changeset
|
163 char demux_dev[32]; |
617754f47828
in preparation for multi-frontend patch replaced file-static device names with sprintf() calls in 2 functions
nicodvb
parents:
25694
diff
changeset
|
164 |
27370
14c5017f40d2
Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents:
26401
diff
changeset
|
165 #ifdef CONFIG_DVB_HEAD |
26401
617754f47828
in preparation for multi-frontend patch replaced file-static device names with sprintf() calls in 2 functions
nicodvb
parents:
25694
diff
changeset
|
166 sprintf(demux_dev, "/dev/dvb/adapter%d/demux0", priv->card); |
617754f47828
in preparation for multi-frontend patch replaced file-static device names with sprintf() calls in 2 functions
nicodvb
parents:
25694
diff
changeset
|
167 #else |
617754f47828
in preparation for multi-frontend patch replaced file-static device names with sprintf() calls in 2 functions
nicodvb
parents:
25694
diff
changeset
|
168 sprintf(demux_dev, "/dev/ost/demux%d", priv->card); |
617754f47828
in preparation for multi-frontend patch replaced file-static device names with sprintf() calls in 2 functions
nicodvb
parents:
25694
diff
changeset
|
169 #endif |
12803
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
170 |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
171 mp_msg(MSGT_DEMUX, MSGL_V, "FIX %d -> %d\n", priv->demux_fds_cnt, cnt); |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
172 if(priv->demux_fds_cnt >= cnt) |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
173 { |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
174 for(i = priv->demux_fds_cnt-1; i >= cnt; i--) |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
175 { |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
176 mp_msg(MSGT_DEMUX, MSGL_V, "FIX, CLOSE fd(%d): %d\n", i, priv->demux_fds[i]); |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
177 close(priv->demux_fds[i]); |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
178 } |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
179 priv->demux_fds_cnt = cnt; |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
180 } |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
181 else if(priv->demux_fds_cnt < cnt) |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
182 { |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
183 for(i = priv->demux_fds_cnt; i < cnt; i++) |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
184 { |
26401
617754f47828
in preparation for multi-frontend patch replaced file-static device names with sprintf() calls in 2 functions
nicodvb
parents:
25694
diff
changeset
|
185 priv->demux_fds[i] = open(demux_dev, O_RDWR | O_NONBLOCK); |
12803
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
186 mp_msg(MSGT_DEMUX, MSGL_V, "FIX, OPEN fd(%d): %d\n", i, priv->demux_fds[i]); |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
187 if(priv->demux_fds[i] < 0) |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
188 { |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
189 mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR OPENING DEMUX 0: %d\n", errno); |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
190 return 0; |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
191 } |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
192 else |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
193 priv->demux_fds_cnt++; |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
194 } |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
195 } |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
196 |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
197 return 1; |
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
198 } |
9610 | 199 |
10560 | 200 int dvb_set_ts_filt(int fd, uint16_t pid, dmx_pes_type_t pestype) |
9610 | 201 { |
202 int i; | |
203 struct dmx_pes_filter_params pesFilterParams; | |
204 | |
205 pesFilterParams.pid = pid; | |
206 pesFilterParams.input = DMX_IN_FRONTEND; | |
207 pesFilterParams.output = DMX_OUT_TS_TAP; | |
27370
14c5017f40d2
Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents:
26401
diff
changeset
|
208 #ifdef CONFIG_DVB_HEAD |
9610 | 209 pesFilterParams.pes_type = pestype; |
210 #else | |
211 pesFilterParams.pesType = pestype; | |
212 #endif | |
213 | |
10560 | 214 pesFilterParams.flags = DMX_IMMEDIATE_START; |
9610 | 215 |
12803
168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents:
12309
diff
changeset
|
216 errno = 0; |
9610 | 217 if ((i = ioctl(fd, DMX_SET_PES_FILTER, &pesFilterParams)) < 0) |
218 { | |
10560 | 219 mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR IN SETTING DMX_FILTER %i for fd %d: ERRNO: %d", pid, fd, errno); |
220 return 0; | |
9610 | 221 } |
222 | |
10560 | 223 mp_msg(MSGT_DEMUX, MSGL_V, "SET PES FILTER ON PID %d to fd %d, RESULT: %d, ERRNO: %d\n", pid, fd, i, errno); |
9610 | 224 return 1; |
225 } | |
226 | |
227 | |
10560 | 228 int dvb_demux_stop(int fd) |
9610 | 229 { |
230 int i; | |
231 i = ioctl(fd, DMX_STOP); | |
232 | |
233 mp_msg(MSGT_DEMUX, MSGL_DBG2, "STOPPING FD: %d, RESULT: %d\n", fd, i); | |
234 | |
235 return (i==0); | |
236 } | |
237 | |
238 | |
10560 | 239 int dvb_demux_start(int fd) |
240 { | |
241 int i; | |
242 i = ioctl(fd, DMX_START); | |
9610 | 243 |
10560 | 244 mp_msg(MSGT_DEMUX, MSGL_DBG2, "STARTING FD: %d, RESULT: %d\n", fd, i); |
245 | |
246 return (i==0); | |
247 } | |
248 | |
249 | |
9610 | 250 static int tune_it(int fd_frontend, int fd_sec, unsigned int freq, unsigned int srate, char pol, int tone, |
251 fe_spectral_inversion_t specInv, unsigned int diseqc, fe_modulation_t modulation, fe_code_rate_t HP_CodeRate, | |
13155
fd40ef23053b
added forgotten dvb-t params lp_coderate and hierarchy
nicodvb
parents:
12803
diff
changeset
|
252 fe_transmit_mode_t TransmissionMode, fe_guard_interval_t guardInterval, fe_bandwidth_t bandwidth, |
18561 | 253 fe_code_rate_t LP_CodeRate, fe_hierarchy_t hier, int tmout); |
9610 | 254 |
255 | |
12309 | 256 int dvb_tune(dvb_priv_t *priv, int freq, char pol, int srate, int diseqc, int tone, |
9610 | 257 fe_spectral_inversion_t specInv, fe_modulation_t modulation, fe_guard_interval_t guardInterval, |
13155
fd40ef23053b
added forgotten dvb-t params lp_coderate and hierarchy
nicodvb
parents:
12803
diff
changeset
|
258 fe_transmit_mode_t TransmissionMode, fe_bandwidth_t bandWidth, fe_code_rate_t HP_CodeRate, |
18561 | 259 fe_code_rate_t LP_CodeRate, fe_hierarchy_t hier, int timeout) |
9610 | 260 { |
11872
d158978a3d3c
Compliance with the DVB power management specification (doesn't close
attila
parents:
11352
diff
changeset
|
261 int ris; |
d158978a3d3c
Compliance with the DVB power management specification (doesn't close
attila
parents:
11352
diff
changeset
|
262 |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
263 mp_msg(MSGT_DEMUX, MSGL_INFO, "dvb_tune Freq: %lu\n", (long unsigned int) freq); |
11872
d158978a3d3c
Compliance with the DVB power management specification (doesn't close
attila
parents:
11352
diff
changeset
|
264 |
18561 | 265 ris = tune_it(priv->fe_fd, priv->sec_fd, freq, srate, pol, tone, specInv, diseqc, modulation, HP_CodeRate, TransmissionMode, guardInterval, bandWidth, LP_CodeRate, hier, timeout); |
9610 | 266 |
11872
d158978a3d3c
Compliance with the DVB power management specification (doesn't close
attila
parents:
11352
diff
changeset
|
267 if(ris != 0) |
d158978a3d3c
Compliance with the DVB power management specification (doesn't close
attila
parents:
11352
diff
changeset
|
268 mp_msg(MSGT_DEMUX, MSGL_INFO, "dvb_tune, TUNING FAILED\n"); |
d158978a3d3c
Compliance with the DVB power management specification (doesn't close
attila
parents:
11352
diff
changeset
|
269 |
d158978a3d3c
Compliance with the DVB power management specification (doesn't close
attila
parents:
11352
diff
changeset
|
270 return (ris == 0); |
9610 | 271 } |
272 | |
273 | |
27370
14c5017f40d2
Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents:
26401
diff
changeset
|
274 #ifndef CONFIG_DVB_HEAD |
9610 | 275 static int SecGetStatus (int fd, struct secStatus *state) |
276 { | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
277 if(ioctl(fd, SEC_GET_STATUS, state) < 0) |
9610 | 278 { |
279 mp_msg(MSGT_DEMUX, MSGL_ERR, ("SEC GET STATUS: ")); | |
280 return -1; | |
281 } | |
282 | |
283 switch (state->busMode) | |
284 { | |
285 case SEC_BUS_IDLE: | |
286 mp_msg(MSGT_DEMUX, MSGL_V, "SEC BUS MODE: IDLE (%d)\n",state->busMode); | |
287 break; | |
288 case SEC_BUS_BUSY: | |
289 mp_msg(MSGT_DEMUX, MSGL_V, "SEC BUS MODE: BUSY (%d)\n",state->busMode); | |
290 break; | |
291 case SEC_BUS_OFF: | |
292 mp_msg(MSGT_DEMUX, MSGL_V, "SEC BUS MODE: OFF (%d)\n",state->busMode); | |
293 break; | |
294 case SEC_BUS_OVERLOAD: | |
295 mp_msg(MSGT_DEMUX, MSGL_V, "SEC BUS MODE: OVERLOAD (%d)\n",state->busMode); | |
296 break; | |
297 default: | |
298 mp_msg(MSGT_DEMUX, MSGL_V, "SEC BUS MODE: unknown (%d)\n",state->busMode); | |
299 break; | |
300 } | |
301 | |
302 switch (state->selVolt) | |
303 { | |
304 case SEC_VOLTAGE_OFF: | |
305 mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: OFF (%d)\n",state->selVolt); | |
306 break; | |
307 case SEC_VOLTAGE_LT: | |
308 mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: LT (%d)\n",state->selVolt); | |
309 break; | |
310 case SEC_VOLTAGE_13: | |
311 mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: 13 (%d)\n",state->selVolt); | |
312 break; | |
313 case SEC_VOLTAGE_13_5: | |
314 mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: 13.5 (%d)\n",state->selVolt); | |
315 break; | |
316 case SEC_VOLTAGE_18: | |
317 mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: 18 (%d)\n",state->selVolt); | |
318 break; | |
319 case SEC_VOLTAGE_18_5: | |
320 mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: 18.5 (%d)\n",state->selVolt); | |
321 break; | |
322 default: | |
323 mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: unknown (%d)\n",state->selVolt); | |
324 break; | |
325 } | |
326 | |
21777 | 327 mp_msg(MSGT_DEMUX, MSGL_V, "SEC CONT TONE: %s\n", (state->contTone == SEC_TONE_ON ? "ON" : "OFF")); |
9610 | 328 return 0; |
329 } | |
330 | |
331 #endif | |
332 | |
333 static void print_status(fe_status_t festatus) | |
334 { | |
335 mp_msg(MSGT_DEMUX, MSGL_V, "FE_STATUS:"); | |
336 if (festatus & FE_HAS_SIGNAL) mp_msg(MSGT_DEMUX, MSGL_V," FE_HAS_SIGNAL"); | |
27370
14c5017f40d2
Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents:
26401
diff
changeset
|
337 #ifdef CONFIG_DVB_HEAD |
9610 | 338 if (festatus & FE_TIMEDOUT) mp_msg(MSGT_DEMUX, MSGL_V, " FE_TIMEDOUT"); |
339 #else | |
340 if (festatus & FE_HAS_POWER) mp_msg(MSGT_DEMUX, MSGL_V, " FE_HAS_POWER"); | |
341 if (festatus & FE_SPECTRUM_INV) mp_msg(MSGT_DEMUX, MSGL_V, " FE_SPECTRUM_INV"); | |
342 if (festatus & FE_TUNER_HAS_LOCK) mp_msg(MSGT_DEMUX, MSGL_V, " FE_TUNER_HAS_LOCK"); | |
343 #endif | |
344 if (festatus & FE_HAS_LOCK) mp_msg(MSGT_DEMUX, MSGL_V, " FE_HAS_LOCK"); | |
345 if (festatus & FE_HAS_CARRIER) mp_msg(MSGT_DEMUX, MSGL_V, " FE_HAS_CARRIER"); | |
346 if (festatus & FE_HAS_VITERBI) mp_msg(MSGT_DEMUX, MSGL_V, " FE_HAS_VITERBI"); | |
347 if (festatus & FE_HAS_SYNC) mp_msg(MSGT_DEMUX, MSGL_V, " FE_HAS_SYNC"); | |
348 mp_msg(MSGT_DEMUX, MSGL_V, "\n"); | |
349 } | |
350 | |
351 | |
27370
14c5017f40d2
Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents:
26401
diff
changeset
|
352 #ifdef CONFIG_DVB_HEAD |
21816 | 353 static int check_status(int fd_frontend, int tmout) |
9610 | 354 { |
355 int32_t strength; | |
356 fe_status_t festatus; | |
357 struct pollfd pfd[1]; | |
14282
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
358 int ok=0, locks=0; |
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
359 time_t tm1, tm2; |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
360 |
9610 | 361 pfd[0].fd = fd_frontend; |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
362 pfd[0].events = POLLPRI; |
9610 | 363 |
14282
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
364 mp_msg(MSGT_DEMUX, MSGL_V, "Getting frontend status\n"); |
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
365 tm1 = tm2 = time((time_t*) NULL); |
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
366 while(!ok) |
9610 | 367 { |
14282
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
368 festatus = 0; |
18561 | 369 if(poll(pfd,1,tmout*1000) > 0) |
9610 | 370 { |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
371 if (pfd[0].revents & POLLPRI) |
9610 | 372 { |
14282
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
373 if(ioctl(fd_frontend, FE_READ_STATUS, &festatus) >= 0) |
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
374 if(festatus & FE_HAS_LOCK) |
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
375 locks++; |
9610 | 376 } |
377 } | |
14282
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
378 usleep(10000); |
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
379 tm2 = time((time_t*) NULL); |
18561 | 380 if((festatus & FE_TIMEDOUT) || (locks >= 2) || (tm2 - tm1 >= tmout)) |
14282
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
381 ok = 1; |
9610 | 382 } |
383 | |
14282
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
384 if(festatus & FE_HAS_LOCK) |
9610 | 385 { |
386 strength=0; | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
387 if(ioctl(fd_frontend,FE_READ_BER,&strength) >= 0) |
9610 | 388 mp_msg(MSGT_DEMUX, MSGL_V, "Bit error rate: %d\n",strength); |
389 | |
390 strength=0; | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
391 if(ioctl(fd_frontend,FE_READ_SIGNAL_STRENGTH,&strength) >= 0) |
9610 | 392 mp_msg(MSGT_DEMUX, MSGL_V, "Signal strength: %d\n",strength); |
393 | |
394 strength=0; | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
395 if(ioctl(fd_frontend,FE_READ_SNR,&strength) >= 0) |
9610 | 396 mp_msg(MSGT_DEMUX, MSGL_V, "SNR: %d\n",strength); |
397 | |
14282
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
398 strength=0; |
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
399 if(ioctl(fd_frontend,FE_READ_UNCORRECTED_BLOCKS,&strength) >= 0) |
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
400 mp_msg(MSGT_DEMUX, MSGL_V, "UNC: %d\n",strength); |
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
401 |
9610 | 402 print_status(festatus); |
403 } | |
404 else | |
405 { | |
18561 | 406 mp_msg(MSGT_DEMUX, MSGL_ERR, "Not able to lock to the signal on the given frequency, timeout: %d\n", tmout); |
9610 | 407 return -1; |
408 } | |
409 return 0; | |
410 } | |
411 | |
412 #else | |
413 | |
21816 | 414 static int check_status(int fd_frontend, int tmout) |
9610 | 415 { |
416 int i,res; | |
417 int32_t strength; | |
418 fe_status_t festatus; | |
419 FrontendEvent event; | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
420 |
9610 | 421 struct pollfd pfd[1]; |
422 | |
423 i = 0; res = -1; | |
424 while ((i < 3) && (res < 0)) | |
425 { | |
426 pfd[0].fd = fd_frontend; | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
427 pfd[0].events = POLLIN | POLLPRI; |
9610 | 428 |
18561 | 429 if(poll(pfd,1,tmout*1000) > 0) |
9610 | 430 { |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
431 if (pfd[0].revents & POLLPRI) |
9610 | 432 { |
433 mp_msg(MSGT_DEMUX, MSGL_V, "Getting frontend event\n"); | |
434 if ( ioctl(fd_frontend, FE_GET_EVENT, &event) < 0) | |
435 { | |
436 mp_msg(MSGT_DEMUX, MSGL_ERR, "FE_GET_EVENT"); | |
437 return -1; | |
438 } | |
439 mp_msg(MSGT_DEMUX, MSGL_V, "Received "); | |
440 switch(event.type) | |
441 { | |
442 case FE_UNEXPECTED_EV: | |
443 mp_msg(MSGT_DEMUX, MSGL_V, "unexpected event\n"); | |
444 res = -1; | |
445 break; | |
446 | |
447 case FE_FAILURE_EV: | |
448 mp_msg(MSGT_DEMUX, MSGL_V, "failure event\n"); | |
449 res = -1; | |
450 break; | |
451 | |
452 case FE_COMPLETION_EV: | |
453 mp_msg(MSGT_DEMUX, MSGL_V, "completion event\n"); | |
454 res = 0; | |
455 break; | |
456 } | |
457 } | |
458 i++; | |
459 } | |
460 } | |
461 | |
462 if (res > 0) | |
463 switch (event.type) | |
464 { | |
465 case FE_UNEXPECTED_EV: mp_msg(MSGT_DEMUX, MSGL_V, "FE_UNEXPECTED_EV\n"); | |
466 break; | |
467 case FE_COMPLETION_EV: mp_msg(MSGT_DEMUX, MSGL_V, "FE_COMPLETION_EV\n"); | |
468 break; | |
469 case FE_FAILURE_EV: mp_msg(MSGT_DEMUX, MSGL_V, "FE_FAILURE_EV\n"); | |
470 break; | |
471 } | |
472 | |
473 if (event.type == FE_COMPLETION_EV) | |
474 { | |
475 strength=0; | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
476 if(ioctl(fd_frontend,FE_READ_BER,&strength) >= 0) |
9610 | 477 mp_msg(MSGT_DEMUX, MSGL_V, "Bit error rate: %d\n",strength); |
478 | |
479 strength=0; | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
480 if(ioctl(fd_frontend,FE_READ_SIGNAL_STRENGTH,&strength) >= 0) |
9610 | 481 mp_msg(MSGT_DEMUX, MSGL_V, "Signal strength: %d\n",strength); |
482 | |
483 strength=0; | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
484 if(ioctl(fd_frontend,FE_READ_SNR,&strength) >= 0) |
9610 | 485 mp_msg(MSGT_DEMUX, MSGL_V, "SNR: %d\n",strength); |
486 | |
487 festatus=0; | |
488 mp_msg(MSGT_DEMUX, MSGL_V, "FE_STATUS:"); | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
489 |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
490 if(ioctl(fd_frontend,FE_READ_STATUS,&festatus) >= 0) |
21777 | 491 print_status(festatus); |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
492 else |
21777 | 493 mp_msg(MSGT_DEMUX, MSGL_ERR, " ERROR, UNABLE TO READ_STATUS"); |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
494 |
9610 | 495 mp_msg(MSGT_DEMUX, MSGL_V, "\n"); |
496 } | |
497 else | |
498 { | |
499 mp_msg(MSGT_DEMUX, MSGL_V, "Not able to lock to the signal on the given frequency\n"); | |
500 return -1; | |
501 } | |
502 return 0; | |
503 } | |
504 #endif | |
505 | |
27370
14c5017f40d2
Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents:
26401
diff
changeset
|
506 #ifdef CONFIG_DVB_HEAD |
9610 | 507 |
21841
4cdc4b2cd3da
removed static declaration before non-instantiated struct; patch by cehoyos ag or at
nicodvb
parents:
21825
diff
changeset
|
508 struct diseqc_cmd { |
9610 | 509 struct dvb_diseqc_master_cmd cmd; |
510 uint32_t wait; | |
511 }; | |
512 | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
513 static int diseqc_send_msg(int fd, fe_sec_voltage_t v, struct diseqc_cmd *cmd, |
9610 | 514 fe_sec_tone_mode_t t, fe_sec_mini_cmd_t b) |
515 { | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
516 if(ioctl(fd, FE_SET_TONE, SEC_TONE_OFF) == -1) |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
517 return -1; |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
518 if(ioctl(fd, FE_SET_VOLTAGE, v) == -1) |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
519 return -1; |
9610 | 520 usleep(15 * 1000); |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
521 if(ioctl(fd, FE_DISEQC_SEND_MASTER_CMD, &cmd->cmd) == -1) |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
522 return -1; |
9610 | 523 usleep(cmd->wait * 1000); |
524 usleep(15 * 1000); | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
525 if(ioctl(fd, FE_DISEQC_SEND_BURST, b) == -1) |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
526 return -1; |
9610 | 527 usleep(15 * 1000); |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
528 if(ioctl(fd, FE_SET_TONE, t) == -1) |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
529 return -1; |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
530 |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
531 return 0; |
9610 | 532 } |
533 | |
534 /* digital satellite equipment control, | |
535 * specification is available from http://www.eutelsat.com/ | |
536 */ | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
537 static int do_diseqc(int secfd, int sat_no, int polv, int hi_lo) |
9610 | 538 { |
539 struct diseqc_cmd cmd = { {{0xe0, 0x10, 0x38, 0xf0, 0x00, 0x00}, 4}, 0 }; | |
540 | |
541 /* param: high nibble: reset bits, low nibble set bits, | |
542 * bits are: option, position, polarizaion, band | |
543 */ | |
544 cmd.cmd.msg[3] = | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
545 0xf0 | (((sat_no * 4) & 0x0f) | (hi_lo ? 1 : 0) | (polv ? 0 : 2)); |
9610 | 546 |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
547 return diseqc_send_msg(secfd, polv ? SEC_VOLTAGE_13 : SEC_VOLTAGE_18, |
9610 | 548 &cmd, hi_lo ? SEC_TONE_ON : SEC_TONE_OFF, |
549 (sat_no / 4) % 2 ? SEC_MINI_B : SEC_MINI_A); | |
550 } | |
551 | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
552 #else |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
553 |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
554 static int do_diseqc(int secfd, int sat_no, int polv, int hi_lo) |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
555 { |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
556 struct secCommand scmd; |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
557 struct secCmdSequence scmds; |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
558 |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
559 scmds.continuousTone = (hi_lo ? SEC_TONE_ON : SEC_TONE_OFF); |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
560 scmds.voltage = (polv ? SEC_VOLTAGE_13 : SEC_VOLTAGE_18); |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
561 scmds.miniCommand = SEC_MINI_NONE; |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
562 |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
563 scmd.type = SEC_CMDTYPE_DISEQC; |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
564 scmds.numCommands = 1; |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
565 scmds.commands = &scmd; |
9610 | 566 |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
567 scmd.u.diseqc.addr = 0x10; |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
568 scmd.u.diseqc.cmd = 0x38; |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
569 scmd.u.diseqc.numParams = 1; |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
570 scmd.u.diseqc.params[0] = 0xf0 | |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
571 (((sat_no) << 2) & 0x0F) | |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
572 (hi_lo ? 1 : 0) | |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
573 (polv ? 0 : 2); |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
574 |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
575 if (ioctl(secfd,SEC_SEND_SEQUENCE,&scmds) < 0) |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
576 { |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
577 mp_msg(MSGT_DEMUX, MSGL_ERR, "Error sending DisEqC"); |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
578 return -1; |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
579 } |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
580 |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
581 return 0; |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
582 } |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
583 #endif |
9610 | 584 |
585 static int tune_it(int fd_frontend, int fd_sec, unsigned int freq, unsigned int srate, char pol, int tone, | |
586 fe_spectral_inversion_t specInv, unsigned int diseqc, fe_modulation_t modulation, fe_code_rate_t HP_CodeRate, | |
13155
fd40ef23053b
added forgotten dvb-t params lp_coderate and hierarchy
nicodvb
parents:
12803
diff
changeset
|
587 fe_transmit_mode_t TransmissionMode, fe_guard_interval_t guardInterval, fe_bandwidth_t bandwidth, |
18561 | 588 fe_code_rate_t LP_CodeRate, fe_hierarchy_t hier, int timeout) |
9610 | 589 { |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
590 int res, hi_lo, dfd; |
27370
14c5017f40d2
Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents:
26401
diff
changeset
|
591 #ifdef CONFIG_DVB_HEAD |
9610 | 592 struct dvb_frontend_parameters feparams; |
593 struct dvb_frontend_info fe_info; | |
594 #else | |
595 FrontendParameters feparams; | |
596 FrontendInfo fe_info; | |
21815
8b2d611f3ade
moved actual tuning code from check_status() to tune_it()
nicodvb
parents:
21777
diff
changeset
|
597 FrontendEvent event; |
9610 | 598 struct secStatus sec_state; |
599 #endif | |
600 | |
601 | |
10560 | 602 mp_msg(MSGT_DEMUX, MSGL_V, "TUNE_IT, fd_frontend %d, fd_sec %d\nfreq %lu, srate %lu, pol %c, tone %i, specInv, diseqc %u, fe_modulation_t modulation,fe_code_rate_t HP_CodeRate, fe_transmit_mode_t TransmissionMode,fe_guard_interval_t guardInterval, fe_bandwidth_t bandwidth\n", |
21825 | 603 fd_frontend, fd_sec, (long unsigned int)freq, (long unsigned int)srate, pol, tone, diseqc); |
9610 | 604 |
605 | |
21824 | 606 memset(&feparams, 0, sizeof(feparams)); |
9610 | 607 if ( (res = ioctl(fd_frontend,FE_GET_INFO, &fe_info) < 0)) |
608 { | |
21825 | 609 mp_msg(MSGT_DEMUX, MSGL_FATAL, "FE_GET_INFO FAILED\n"); |
610 return -1; | |
9610 | 611 } |
612 | |
613 | |
27370
14c5017f40d2
Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents:
26401
diff
changeset
|
614 #ifdef CONFIG_DVB_HEAD |
10560 | 615 mp_msg(MSGT_DEMUX, MSGL_V, "Using DVB card \"%s\"\n", fe_info.name); |
9610 | 616 #endif |
617 | |
618 switch(fe_info.type) | |
619 { | |
620 case FE_OFDM: | |
27370
14c5017f40d2
Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents:
26401
diff
changeset
|
621 #ifdef CONFIG_DVB_HEAD |
9610 | 622 if (freq < 1000000) freq*=1000UL; |
623 feparams.frequency=freq; | |
11872
d158978a3d3c
Compliance with the DVB power management specification (doesn't close
attila
parents:
11352
diff
changeset
|
624 feparams.inversion=specInv; |
9610 | 625 feparams.u.ofdm.bandwidth=bandwidth; |
626 feparams.u.ofdm.code_rate_HP=HP_CodeRate; | |
13155
fd40ef23053b
added forgotten dvb-t params lp_coderate and hierarchy
nicodvb
parents:
12803
diff
changeset
|
627 feparams.u.ofdm.code_rate_LP=LP_CodeRate; |
9610 | 628 feparams.u.ofdm.constellation=modulation; |
629 feparams.u.ofdm.transmission_mode=TransmissionMode; | |
630 feparams.u.ofdm.guard_interval=guardInterval; | |
13155
fd40ef23053b
added forgotten dvb-t params lp_coderate and hierarchy
nicodvb
parents:
12803
diff
changeset
|
631 feparams.u.ofdm.hierarchy_information=hier; |
9610 | 632 #else |
633 if (freq < 1000000) freq*=1000UL; | |
634 feparams.Frequency=freq; | |
11872
d158978a3d3c
Compliance with the DVB power management specification (doesn't close
attila
parents:
11352
diff
changeset
|
635 feparams.Inversion=specInv; |
9610 | 636 feparams.u.ofdm.bandWidth=bandwidth; |
637 feparams.u.ofdm.HP_CodeRate=HP_CodeRate; | |
13155
fd40ef23053b
added forgotten dvb-t params lp_coderate and hierarchy
nicodvb
parents:
12803
diff
changeset
|
638 feparams.u.ofdm.LP_CodeRate=LP_CodeRate; |
9610 | 639 feparams.u.ofdm.Constellation=modulation; |
640 feparams.u.ofdm.TransmissionMode=TransmissionMode; | |
641 feparams.u.ofdm.guardInterval=guardInterval; | |
13155
fd40ef23053b
added forgotten dvb-t params lp_coderate and hierarchy
nicodvb
parents:
12803
diff
changeset
|
642 feparams.u.ofdm.HierarchyInformation=hier; |
9610 | 643 #endif |
14282
2188637c0e8f
replaced deprecated FE_GET_EVENT with FE_READ_STATUS (only for DVB_HEAD); added a workaround for drivers that don't support FE_TIMEDOUT
nicodvb
parents:
13155
diff
changeset
|
644 mp_msg(MSGT_DEMUX, MSGL_V, "tuning DVB-T to %d Hz, bandwidth: %d\n",freq, bandwidth); |
9610 | 645 break; |
646 case FE_QPSK: | |
647 if (freq > 2200000) | |
648 { | |
649 // this must be an absolute frequency | |
650 if (freq < SLOF) | |
21825 | 651 { |
27370
14c5017f40d2
Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents:
26401
diff
changeset
|
652 #ifdef CONFIG_DVB_HEAD |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
653 freq = feparams.frequency=(freq-LOF1); |
9610 | 654 #else |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
655 freq = feparams.Frequency=(freq-LOF1); |
9610 | 656 #endif |
21825 | 657 hi_lo = 0; |
9610 | 658 } |
21825 | 659 else |
660 { | |
27370
14c5017f40d2
Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents:
26401
diff
changeset
|
661 #ifdef CONFIG_DVB_HEAD |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
662 freq = feparams.frequency=(freq-LOF2); |
9610 | 663 #else |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
664 freq = feparams.Frequency=(freq-LOF2); |
9610 | 665 #endif |
21825 | 666 hi_lo = 1; |
9610 | 667 } |
668 } | |
669 else | |
670 { | |
671 // this is an L-Band frequency | |
27370
14c5017f40d2
Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents:
26401
diff
changeset
|
672 #ifdef CONFIG_DVB_HEAD |
9610 | 673 feparams.frequency=freq; |
674 #else | |
675 feparams.Frequency=freq; | |
676 #endif | |
677 } | |
678 | |
27370
14c5017f40d2
Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents:
26401
diff
changeset
|
679 #ifdef CONFIG_DVB_HEAD |
9610 | 680 feparams.inversion=specInv; |
681 feparams.u.qpsk.symbol_rate=srate; | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
682 feparams.u.qpsk.fec_inner=HP_CodeRate; |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
683 dfd = fd_frontend; |
9610 | 684 #else |
685 feparams.Inversion=specInv; | |
686 feparams.u.qpsk.SymbolRate=srate; | |
12048
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
687 feparams.u.qpsk.FEC_inner=HP_CodeRate; |
09aae06de9c8
removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents:
11872
diff
changeset
|
688 dfd = fd_sec; |
9610 | 689 #endif |
690 | |
21825 | 691 mp_msg(MSGT_DEMUX, MSGL_V, "tuning DVB-S to Freq: %u, Pol: %c Srate: %d, 22kHz: %s, LNB: %d\n",freq,pol,srate,hi_lo ? "on" : "off", diseqc); |
9610 | 692 |
21825 | 693 if(do_diseqc(dfd, diseqc, (pol == 'V' ? 1 : 0), hi_lo) == 0) |
694 mp_msg(MSGT_DEMUX, MSGL_V, "DISEQC SETTING SUCCEDED\n"); | |
695 else | |
696 { | |
697 mp_msg(MSGT_DEMUX, MSGL_ERR, "DISEQC SETTING FAILED\n"); | |
698 return -1; | |
699 } | |
9610 | 700 break; |
701 case FE_QAM: | |
702 mp_msg(MSGT_DEMUX, MSGL_V, "tuning DVB-C to %d, srate=%d\n",freq,srate); | |
27370
14c5017f40d2
Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents:
26401
diff
changeset
|
703 #ifdef CONFIG_DVB_HEAD |
9610 | 704 feparams.frequency=freq; |
11872
d158978a3d3c
Compliance with the DVB power management specification (doesn't close
attila
parents:
11352
diff
changeset
|
705 feparams.inversion=specInv; |
9610 | 706 feparams.u.qam.symbol_rate = srate; |
11872
d158978a3d3c
Compliance with the DVB power management specification (doesn't close
attila
parents:
11352
diff
changeset
|
707 feparams.u.qam.fec_inner = HP_CodeRate; |
d158978a3d3c
Compliance with the DVB power management specification (doesn't close
attila
parents:
11352
diff
changeset
|
708 feparams.u.qam.modulation = modulation; |
9610 | 709 #else |
710 feparams.Frequency=freq; | |
11872
d158978a3d3c
Compliance with the DVB power management specification (doesn't close
attila
parents:
11352
diff
changeset
|
711 feparams.Inversion=specInv; |
9610 | 712 feparams.u.qam.SymbolRate = srate; |
11872
d158978a3d3c
Compliance with the DVB power management specification (doesn't close
attila
parents:
11352
diff
changeset
|
713 feparams.u.qam.FEC_inner = HP_CodeRate; |
d158978a3d3c
Compliance with the DVB power management specification (doesn't close
attila
parents:
11352
diff
changeset
|
714 feparams.u.qam.QAM = modulation; |
9610 | 715 #endif |
716 break; | |
14382 | 717 #ifdef DVB_ATSC |
718 case FE_ATSC: | |
719 mp_msg(MSGT_DEMUX, MSGL_V, "tuning ATSC to %d, modulation=%d\n",freq,modulation); | |
720 feparams.frequency=freq; | |
721 feparams.u.vsb.modulation = modulation; | |
722 break; | |
723 #endif | |
9610 | 724 default: |
725 mp_msg(MSGT_DEMUX, MSGL_V, "Unknown FE type. Aborting\n"); | |
10603 | 726 return 0; |
9610 | 727 } |
728 usleep(100000); | |
729 | |
27370
14c5017f40d2
Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents:
26401
diff
changeset
|
730 #ifndef CONFIG_DVB_HEAD |
9610 | 731 if (fd_sec) SecGetStatus(fd_sec, &sec_state); |
21815
8b2d611f3ade
moved actual tuning code from check_status() to tune_it()
nicodvb
parents:
21777
diff
changeset
|
732 while(1) |
8b2d611f3ade
moved actual tuning code from check_status() to tune_it()
nicodvb
parents:
21777
diff
changeset
|
733 { |
8b2d611f3ade
moved actual tuning code from check_status() to tune_it()
nicodvb
parents:
21777
diff
changeset
|
734 if(ioctl(fd_frontend, FE_GET_EVENT, &event) == -1) |
8b2d611f3ade
moved actual tuning code from check_status() to tune_it()
nicodvb
parents:
21777
diff
changeset
|
735 break; |
8b2d611f3ade
moved actual tuning code from check_status() to tune_it()
nicodvb
parents:
21777
diff
changeset
|
736 } |
9610 | 737 #endif |
738 | |
21815
8b2d611f3ade
moved actual tuning code from check_status() to tune_it()
nicodvb
parents:
21777
diff
changeset
|
739 if(ioctl(fd_frontend,FE_SET_FRONTEND,&feparams) < 0) |
8b2d611f3ade
moved actual tuning code from check_status() to tune_it()
nicodvb
parents:
21777
diff
changeset
|
740 { |
8b2d611f3ade
moved actual tuning code from check_status() to tune_it()
nicodvb
parents:
21777
diff
changeset
|
741 mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR tuning channel\n"); |
8b2d611f3ade
moved actual tuning code from check_status() to tune_it()
nicodvb
parents:
21777
diff
changeset
|
742 return -1; |
8b2d611f3ade
moved actual tuning code from check_status() to tune_it()
nicodvb
parents:
21777
diff
changeset
|
743 } |
8b2d611f3ade
moved actual tuning code from check_status() to tune_it()
nicodvb
parents:
21777
diff
changeset
|
744 |
21816 | 745 return(check_status(fd_frontend, timeout)); |
9610 | 746 } |