annotate stream/dvb_tune.c @ 30525:956bdcb944aa

Change aspect calculation code to switch to floating point earlier so integer overflows are not possible.
author reimar
date Sun, 14 Feb 2010 11:13:20 +0000
parents afc8b80eb027
children 7a5b8fc5df4a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
1 /* dvbtune - tune.c
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
2
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
3 Copyright (C) Dave Chapman 2001,2002
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
4
18783
0783dd397f74 CVS --> Subversion in copyright notices
diego
parents: 18561
diff changeset
5 Modified for use with MPlayer, for details see the changelog at
0783dd397f74 CVS --> Subversion in copyright notices
diego
parents: 18561
diff changeset
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
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
9 This program is free software; you can redistribute it and/or
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
10 modify it under the terms of the GNU General Public License
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
11 as published by the Free Software Foundation; either version 2
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
12 of the License, or (at your option) any later version.
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
13
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
14 This program is distributed in the hope that it will be useful,
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
17 GNU General Public License for more details.
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
18
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
19 You should have received a copy of the GNU General Public License
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
20 along with this program; if not, write to the Free Software
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
22 Or, point your browser to http://www.gnu.org/copyleft/gpl.html
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
23
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
24 */
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
25
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
26 #include <stdio.h>
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
27 #include <stdlib.h>
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
28 #include <ctype.h>
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
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
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
31 #include <unistd.h>
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
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
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
34 #include <errno.h>
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
35 #include "config.h"
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
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
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
38 #include <linux/dvb/dmx.h>
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
39 #include <linux/dvb/frontend.h>
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
40 #else
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
41 #include <ost/dmx.h>
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
42 #include <ost/sec.h>
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
43 #include <ost/frontend.h>
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
44 #endif
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
45
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
46 #include "dvbin.h"
17012
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 15178
diff changeset
47 #include "mp_msg.h"
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
48
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
49
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
50
12309
5c375ea5fb0f new configuration structure, gcc warn silencing
nicodvb
parents: 12048
diff changeset
51 int dvb_get_tuner_type(int fe_fd)
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
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
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
54 struct dvb_frontend_info fe_info;
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
55 #else
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
56 FrontendInfo fe_info;
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
57 #endif
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
58
12309
5c375ea5fb0f new configuration structure, gcc warn silencing
nicodvb
parents: 12048
diff changeset
59 int res;
11872
d158978a3d3c Compliance with the DVB power management specification (doesn't close
attila
parents: 11352
diff changeset
60
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
61 res = ioctl(fe_fd, FE_GET_INFO, &fe_info);
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
62 if(res < 0)
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
63 {
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
64 mp_msg(MSGT_DEMUX, MSGL_ERR, "FE_GET_INFO error: %d, FD: %d\n\n", errno, fe_fd);
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
65 return 0;
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
66 }
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
67
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
68 switch(fe_info.type)
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
69 {
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
70 case FE_OFDM:
12309
5c375ea5fb0f new configuration structure, gcc warn silencing
nicodvb
parents: 12048
diff changeset
71 mp_msg(MSGT_DEMUX, MSGL_V, "TUNER TYPE SEEMS TO BE DVB-T\n");
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
72 return TUNER_TER;
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
73
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
74 case FE_QPSK:
12309
5c375ea5fb0f new configuration structure, gcc warn silencing
nicodvb
parents: 12048
diff changeset
75 mp_msg(MSGT_DEMUX, MSGL_V, "TUNER TYPE SEEMS TO BE DVB-S\n");
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
76 return TUNER_SAT;
11872
d158978a3d3c Compliance with the DVB power management specification (doesn't close
attila
parents: 11352
diff changeset
77
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
78 case FE_QAM:
12309
5c375ea5fb0f new configuration structure, gcc warn silencing
nicodvb
parents: 12048
diff changeset
79 mp_msg(MSGT_DEMUX, MSGL_V, "TUNER TYPE SEEMS TO BE DVB-C\n");
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
80 return TUNER_CBL;
11872
d158978a3d3c Compliance with the DVB power management specification (doesn't close
attila
parents: 11352
diff changeset
81
14382
42d792053cde added support for ATSC tuner and conf.file
nicodvb
parents: 14282
diff changeset
82 #ifdef DVB_ATSC
42d792053cde added support for ATSC tuner and conf.file
nicodvb
parents: 14282
diff changeset
83 case FE_ATSC:
42d792053cde added support for ATSC tuner and conf.file
nicodvb
parents: 14282
diff changeset
84 mp_msg(MSGT_DEMUX, MSGL_V, "TUNER TYPE SEEMS TO BE DVB-ATSC\n");
42d792053cde added support for ATSC tuner and conf.file
nicodvb
parents: 14282
diff changeset
85 return TUNER_ATSC;
42d792053cde added support for ATSC tuner and conf.file
nicodvb
parents: 14282
diff changeset
86 #endif
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
87 default:
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
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
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
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
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
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
fe6dc73c7314 removed unused variables and parameters
nicodvb
parents: 24861
diff changeset
96 int dvb_open_devices(dvb_priv_t *priv, int n, int demux_cnt)
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
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
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
115 if(priv->fe_fd < 0)
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
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
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
118 return 0;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
119 }
27863
f3384addfb0b set to -1 fds that were closed; handle the sec_fd only if CONFIG_DVB_HEAD isn't defined; patch by Reimar
nicodvb
parents: 27859
diff changeset
120 #ifndef 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
121 priv->sec_fd = open(sec_dev, O_RDWR);
21777
3af036ae3c75 reindentation
nicodvb
parents: 19271
diff changeset
122 if(priv->sec_fd < 0)
3af036ae3c75 reindentation
nicodvb
parents: 19271
diff changeset
123 {
26401
617754f47828 in preparation for multi-frontend patch replaced file-static device names with sprintf() calls in 2 functions
nicodvb
parents: 25694
diff changeset
124 mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR OPENING SEC DEVICE %s: ERRNO %d\n", sec_dev, errno);
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
125 close(priv->fe_fd);
21777
3af036ae3c75 reindentation
nicodvb
parents: 19271
diff changeset
126 return 0;
3af036ae3c75 reindentation
nicodvb
parents: 19271
diff changeset
127 }
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
128 #endif
12803
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
129 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
130 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
131 for(i = 0; i < demux_cnt; i++)
12309
5c375ea5fb0f new configuration structure, gcc warn silencing
nicodvb
parents: 12048
diff changeset
132 {
26401
617754f47828 in preparation for multi-frontend patch replaced file-static device names with sprintf() calls in 2 functions
nicodvb
parents: 25694
diff changeset
133 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
134 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
135 {
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
136 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
137 return 0;
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
138 }
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
139 else
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
140 {
26401
617754f47828 in preparation for multi-frontend patch replaced file-static device names with sprintf() calls in 2 functions
nicodvb
parents: 25694
diff changeset
141 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
142 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
143 }
12309
5c375ea5fb0f new configuration structure, gcc warn silencing
nicodvb
parents: 12048
diff changeset
144 }
5c375ea5fb0f new configuration structure, gcc warn silencing
nicodvb
parents: 12048
diff changeset
145
5c375ea5fb0f new configuration structure, gcc warn silencing
nicodvb
parents: 12048
diff changeset
146
26401
617754f47828 in preparation for multi-frontend patch replaced file-static device names with sprintf() calls in 2 functions
nicodvb
parents: 25694
diff changeset
147 priv->dvr_fd = open(dvr_dev, O_RDONLY| O_NONBLOCK);
12309
5c375ea5fb0f new configuration structure, gcc warn silencing
nicodvb
parents: 12048
diff changeset
148 if(priv->dvr_fd < 0)
5c375ea5fb0f new configuration structure, gcc warn silencing
nicodvb
parents: 12048
diff changeset
149 {
26401
617754f47828 in preparation for multi-frontend patch replaced file-static device names with sprintf() calls in 2 functions
nicodvb
parents: 25694
diff changeset
150 mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR OPENING DVR DEVICE %s: %d\n", dvr_dev, errno);
12309
5c375ea5fb0f new configuration structure, gcc warn silencing
nicodvb
parents: 12048
diff changeset
151 return 0;
5c375ea5fb0f new configuration structure, gcc warn silencing
nicodvb
parents: 12048
diff changeset
152 }
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
153
21777
3af036ae3c75 reindentation
nicodvb
parents: 19271
diff changeset
154 return 1;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
155 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
156
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
157
24875
fe6dc73c7314 removed unused variables and parameters
nicodvb
parents: 24861
diff changeset
158 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
159 {
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
160 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
161 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
162
27370
14c5017f40d2 Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents: 26401
diff changeset
163 #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
164 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
165 #else
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/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
167 #endif
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27863
diff changeset
168
12803
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
169 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
170 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
171 {
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
172 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
173 {
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
174 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
175 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
176 }
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
177 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
178 }
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
179 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
180 {
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
181 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
182 {
26401
617754f47828 in preparation for multi-frontend patch replaced file-static device names with sprintf() calls in 2 functions
nicodvb
parents: 25694
diff changeset
183 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
184 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
185 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
186 {
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
187 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
188 return 0;
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
189 }
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
190 else
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
191 priv->demux_fds_cnt++;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27863
diff changeset
192 }
12803
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
193 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27863
diff changeset
194
12803
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
195 return 1;
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
196 }
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
197
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
198 int dvb_set_ts_filt(int fd, uint16_t pid, dmx_pes_type_t pestype)
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
199 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
200 int i;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
201 struct dmx_pes_filter_params pesFilterParams;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
202
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
203 pesFilterParams.pid = pid;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
204 pesFilterParams.input = DMX_IN_FRONTEND;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
205 pesFilterParams.output = DMX_OUT_TS_TAP;
27370
14c5017f40d2 Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents: 26401
diff changeset
206 #ifdef CONFIG_DVB_HEAD
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
207 pesFilterParams.pes_type = pestype;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
208 #else
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
209 pesFilterParams.pesType = pestype;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
210 #endif
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
211
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
212 pesFilterParams.flags = DMX_IMMEDIATE_START;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
213
12803
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
214 errno = 0;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
215 if ((i = ioctl(fd, DMX_SET_PES_FILTER, &pesFilterParams)) < 0)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
216 {
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
217 mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR IN SETTING DMX_FILTER %i for fd %d: ERRNO: %d", pid, fd, errno);
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
218 return 0;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
219 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
220
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
221 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
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
222 return 1;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
223 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
224
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
225
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
226 int dvb_demux_stop(int fd)
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
227 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
228 int i;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
229 i = ioctl(fd, DMX_STOP);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
230
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
231 mp_msg(MSGT_DEMUX, MSGL_DBG2, "STOPPING FD: %d, RESULT: %d\n", fd, i);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
232
29717
afc8b80eb027 cosmetics: Remove some pointless parentheses from return calls.
diego
parents: 29263
diff changeset
233 return i == 0;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
234 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
235
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
236
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
237 int dvb_demux_start(int fd)
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
238 {
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
239 int i;
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
240 i = ioctl(fd, DMX_START);
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
241
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
242 mp_msg(MSGT_DEMUX, MSGL_DBG2, "STARTING FD: %d, RESULT: %d\n", fd, i);
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
243
29717
afc8b80eb027 cosmetics: Remove some pointless parentheses from return calls.
diego
parents: 29263
diff changeset
244 return i == 0;
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
245 }
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
246
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
247
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
248 static int tune_it(int fd_frontend, int fd_sec, unsigned int freq, unsigned int srate, char pol, int tone,
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
249 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
250 fe_transmit_mode_t TransmissionMode, fe_guard_interval_t guardInterval, fe_bandwidth_t bandwidth,
18561
15fbdb09330f configurable tuning timeout
nicodvb
parents: 17012
diff changeset
251 fe_code_rate_t LP_CodeRate, fe_hierarchy_t hier, int tmout);
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
252
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
253
12309
5c375ea5fb0f new configuration structure, gcc warn silencing
nicodvb
parents: 12048
diff changeset
254 int dvb_tune(dvb_priv_t *priv, int freq, char pol, int srate, int diseqc, int tone,
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
255 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
256 fe_transmit_mode_t TransmissionMode, fe_bandwidth_t bandWidth, fe_code_rate_t HP_CodeRate,
18561
15fbdb09330f configurable tuning timeout
nicodvb
parents: 17012
diff changeset
257 fe_code_rate_t LP_CodeRate, fe_hierarchy_t hier, int timeout)
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
258 {
11872
d158978a3d3c Compliance with the DVB power management specification (doesn't close
attila
parents: 11352
diff changeset
259 int ris;
d158978a3d3c Compliance with the DVB power management specification (doesn't close
attila
parents: 11352
diff changeset
260
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
261 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
262
18561
15fbdb09330f configurable tuning timeout
nicodvb
parents: 17012
diff changeset
263 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
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
264
11872
d158978a3d3c Compliance with the DVB power management specification (doesn't close
attila
parents: 11352
diff changeset
265 if(ris != 0)
d158978a3d3c Compliance with the DVB power management specification (doesn't close
attila
parents: 11352
diff changeset
266 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
267
29717
afc8b80eb027 cosmetics: Remove some pointless parentheses from return calls.
diego
parents: 29263
diff changeset
268 return ris == 0;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
269 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
270
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
271
27370
14c5017f40d2 Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents: 26401
diff changeset
272 #ifndef CONFIG_DVB_HEAD
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
273 static int SecGetStatus (int fd, struct secStatus *state)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
274 {
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
275 if(ioctl(fd, SEC_GET_STATUS, state) < 0)
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
276 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
277 mp_msg(MSGT_DEMUX, MSGL_ERR, ("SEC GET STATUS: "));
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
278 return -1;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
279 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
280
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
281 switch (state->busMode)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
282 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
283 case SEC_BUS_IDLE:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
284 mp_msg(MSGT_DEMUX, MSGL_V, "SEC BUS MODE: IDLE (%d)\n",state->busMode);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
285 break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
286 case SEC_BUS_BUSY:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
287 mp_msg(MSGT_DEMUX, MSGL_V, "SEC BUS MODE: BUSY (%d)\n",state->busMode);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
288 break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
289 case SEC_BUS_OFF:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
290 mp_msg(MSGT_DEMUX, MSGL_V, "SEC BUS MODE: OFF (%d)\n",state->busMode);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
291 break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
292 case SEC_BUS_OVERLOAD:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
293 mp_msg(MSGT_DEMUX, MSGL_V, "SEC BUS MODE: OVERLOAD (%d)\n",state->busMode);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
294 break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
295 default:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
296 mp_msg(MSGT_DEMUX, MSGL_V, "SEC BUS MODE: unknown (%d)\n",state->busMode);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
297 break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
298 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
299
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
300 switch (state->selVolt)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
301 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
302 case SEC_VOLTAGE_OFF:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
303 mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: OFF (%d)\n",state->selVolt);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
304 break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
305 case SEC_VOLTAGE_LT:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
306 mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: LT (%d)\n",state->selVolt);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
307 break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
308 case SEC_VOLTAGE_13:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
309 mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: 13 (%d)\n",state->selVolt);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
310 break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
311 case SEC_VOLTAGE_13_5:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
312 mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: 13.5 (%d)\n",state->selVolt);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
313 break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
314 case SEC_VOLTAGE_18:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
315 mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: 18 (%d)\n",state->selVolt);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
316 break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
317 case SEC_VOLTAGE_18_5:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
318 mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: 18.5 (%d)\n",state->selVolt);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
319 break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
320 default:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
321 mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: unknown (%d)\n",state->selVolt);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
322 break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
323 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
324
21777
3af036ae3c75 reindentation
nicodvb
parents: 19271
diff changeset
325 mp_msg(MSGT_DEMUX, MSGL_V, "SEC CONT TONE: %s\n", (state->contTone == SEC_TONE_ON ? "ON" : "OFF"));
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
326 return 0;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
327 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
328
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
329 #endif
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
330
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
331 static void print_status(fe_status_t festatus)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
332 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
333 mp_msg(MSGT_DEMUX, MSGL_V, "FE_STATUS:");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
334 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
335 #ifdef CONFIG_DVB_HEAD
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
336 if (festatus & FE_TIMEDOUT) mp_msg(MSGT_DEMUX, MSGL_V, " FE_TIMEDOUT");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
337 #else
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
338 if (festatus & FE_HAS_POWER) mp_msg(MSGT_DEMUX, MSGL_V, " FE_HAS_POWER");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
339 if (festatus & FE_SPECTRUM_INV) mp_msg(MSGT_DEMUX, MSGL_V, " FE_SPECTRUM_INV");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
340 if (festatus & FE_TUNER_HAS_LOCK) mp_msg(MSGT_DEMUX, MSGL_V, " FE_TUNER_HAS_LOCK");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
341 #endif
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
342 if (festatus & FE_HAS_LOCK) mp_msg(MSGT_DEMUX, MSGL_V, " FE_HAS_LOCK");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
343 if (festatus & FE_HAS_CARRIER) mp_msg(MSGT_DEMUX, MSGL_V, " FE_HAS_CARRIER");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
344 if (festatus & FE_HAS_VITERBI) mp_msg(MSGT_DEMUX, MSGL_V, " FE_HAS_VITERBI");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
345 if (festatus & FE_HAS_SYNC) mp_msg(MSGT_DEMUX, MSGL_V, " FE_HAS_SYNC");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
346 mp_msg(MSGT_DEMUX, MSGL_V, "\n");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
347 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
348
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
349
27370
14c5017f40d2 Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents: 26401
diff changeset
350 #ifdef CONFIG_DVB_HEAD
21816
fa8128898231 removed useless reporting code
nicodvb
parents: 21815
diff changeset
351 static int check_status(int fd_frontend, int tmout)
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
352 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
353 int32_t strength;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
354 fe_status_t festatus;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
355 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
356 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
357 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
358
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
359 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
360 pfd[0].events = POLLPRI;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
361
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
362 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
363 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
364 while(!ok)
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
365 {
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
366 festatus = 0;
18561
15fbdb09330f configurable tuning timeout
nicodvb
parents: 17012
diff changeset
367 if(poll(pfd,1,tmout*1000) > 0)
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
368 {
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
369 if (pfd[0].revents & POLLPRI)
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
370 {
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
371 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
372 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
373 locks++;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
374 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
375 }
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
376 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
377 tm2 = time((time_t*) NULL);
18561
15fbdb09330f configurable tuning timeout
nicodvb
parents: 17012
diff changeset
378 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
379 ok = 1;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
380 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
381
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
382 if(festatus & FE_HAS_LOCK)
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
383 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
384 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
385 if(ioctl(fd_frontend,FE_READ_BER,&strength) >= 0)
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
386 mp_msg(MSGT_DEMUX, MSGL_V, "Bit error rate: %d\n",strength);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
387
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
388 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
389 if(ioctl(fd_frontend,FE_READ_SIGNAL_STRENGTH,&strength) >= 0)
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
390 mp_msg(MSGT_DEMUX, MSGL_V, "Signal strength: %d\n",strength);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
391
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
392 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
393 if(ioctl(fd_frontend,FE_READ_SNR,&strength) >= 0)
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
394 mp_msg(MSGT_DEMUX, MSGL_V, "SNR: %d\n",strength);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
395
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
396 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
397 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
398 mp_msg(MSGT_DEMUX, MSGL_V, "UNC: %d\n",strength);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27863
diff changeset
399
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
400 print_status(festatus);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
401 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
402 else
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
403 {
18561
15fbdb09330f configurable tuning timeout
nicodvb
parents: 17012
diff changeset
404 mp_msg(MSGT_DEMUX, MSGL_ERR, "Not able to lock to the signal on the given frequency, timeout: %d\n", tmout);
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
405 return -1;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
406 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
407 return 0;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
408 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
409
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
410 #else
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
411
21816
fa8128898231 removed useless reporting code
nicodvb
parents: 21815
diff changeset
412 static int check_status(int fd_frontend, int tmout)
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
413 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
414 int i,res;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
415 int32_t strength;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
416 fe_status_t festatus;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
417 FrontendEvent event;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27863
diff changeset
418
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
419 struct pollfd pfd[1];
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
420
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
421 i = 0; res = -1;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
422 while ((i < 3) && (res < 0))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
423 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
424 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
425 pfd[0].events = POLLIN | POLLPRI;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
426
18561
15fbdb09330f configurable tuning timeout
nicodvb
parents: 17012
diff changeset
427 if(poll(pfd,1,tmout*1000) > 0)
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
428 {
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
429 if (pfd[0].revents & POLLPRI)
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
430 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
431 mp_msg(MSGT_DEMUX, MSGL_V, "Getting frontend event\n");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
432 if ( ioctl(fd_frontend, FE_GET_EVENT, &event) < 0)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
433 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
434 mp_msg(MSGT_DEMUX, MSGL_ERR, "FE_GET_EVENT");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
435 return -1;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
436 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
437 mp_msg(MSGT_DEMUX, MSGL_V, "Received ");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
438 switch(event.type)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
439 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
440 case FE_UNEXPECTED_EV:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
441 mp_msg(MSGT_DEMUX, MSGL_V, "unexpected event\n");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
442 res = -1;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
443 break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
444
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
445 case FE_FAILURE_EV:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
446 mp_msg(MSGT_DEMUX, MSGL_V, "failure event\n");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
447 res = -1;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
448 break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
449
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
450 case FE_COMPLETION_EV:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
451 mp_msg(MSGT_DEMUX, MSGL_V, "completion event\n");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
452 res = 0;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
453 break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
454 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
455 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
456 i++;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
457 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
458 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
459
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
460 if (res > 0)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
461 switch (event.type)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
462 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
463 case FE_UNEXPECTED_EV: mp_msg(MSGT_DEMUX, MSGL_V, "FE_UNEXPECTED_EV\n");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
464 break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
465 case FE_COMPLETION_EV: mp_msg(MSGT_DEMUX, MSGL_V, "FE_COMPLETION_EV\n");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
466 break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
467 case FE_FAILURE_EV: mp_msg(MSGT_DEMUX, MSGL_V, "FE_FAILURE_EV\n");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
468 break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
469 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
470
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
471 if (event.type == FE_COMPLETION_EV)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
472 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
473 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
474 if(ioctl(fd_frontend,FE_READ_BER,&strength) >= 0)
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
475 mp_msg(MSGT_DEMUX, MSGL_V, "Bit error rate: %d\n",strength);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
476
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
477 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
478 if(ioctl(fd_frontend,FE_READ_SIGNAL_STRENGTH,&strength) >= 0)
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
479 mp_msg(MSGT_DEMUX, MSGL_V, "Signal strength: %d\n",strength);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
480
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
481 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
482 if(ioctl(fd_frontend,FE_READ_SNR,&strength) >= 0)
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
483 mp_msg(MSGT_DEMUX, MSGL_V, "SNR: %d\n",strength);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
484
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
485 festatus=0;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
486 mp_msg(MSGT_DEMUX, MSGL_V, "FE_STATUS:");
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27863
diff changeset
487
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
488 if(ioctl(fd_frontend,FE_READ_STATUS,&festatus) >= 0)
21777
3af036ae3c75 reindentation
nicodvb
parents: 19271
diff changeset
489 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
490 else
21777
3af036ae3c75 reindentation
nicodvb
parents: 19271
diff changeset
491 mp_msg(MSGT_DEMUX, MSGL_ERR, " ERROR, UNABLE TO READ_STATUS");
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27863
diff changeset
492
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
493 mp_msg(MSGT_DEMUX, MSGL_V, "\n");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
494 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
495 else
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
496 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
497 mp_msg(MSGT_DEMUX, MSGL_V, "Not able to lock to the signal on the given frequency\n");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
498 return -1;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
499 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
500 return 0;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
501 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
502 #endif
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
503
27370
14c5017f40d2 Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents: 26401
diff changeset
504 #ifdef CONFIG_DVB_HEAD
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
505
21841
4cdc4b2cd3da removed static declaration before non-instantiated struct; patch by cehoyos ag or at
nicodvb
parents: 21825
diff changeset
506 struct diseqc_cmd {
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
507 struct dvb_diseqc_master_cmd cmd;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
508 uint32_t wait;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
509 };
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
510
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
511 static int diseqc_send_msg(int fd, fe_sec_voltage_t v, struct diseqc_cmd *cmd,
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
512 fe_sec_tone_mode_t t, fe_sec_mini_cmd_t b)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
513 {
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
514 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
515 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
516 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
517 return -1;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
518 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
519 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
520 return -1;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
521 usleep(cmd->wait * 1000);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
522 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
523 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
524 return -1;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
525 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
526 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
527 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
528
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 0;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
530 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
531
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
532 /* digital satellite equipment control,
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
533 * specification is available from http://www.eutelsat.com/
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
534 */
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
535 static int do_diseqc(int secfd, int sat_no, int polv, int hi_lo)
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
536 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
537 struct diseqc_cmd cmd = { {{0xe0, 0x10, 0x38, 0xf0, 0x00, 0x00}, 4}, 0 };
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
538
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
539 /* param: high nibble: reset bits, low nibble set bits,
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
540 * bits are: option, position, polarizaion, band
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
541 */
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
542 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
543 0xf0 | (((sat_no * 4) & 0x0f) | (hi_lo ? 1 : 0) | (polv ? 0 : 2));
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
544
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 return diseqc_send_msg(secfd, polv ? SEC_VOLTAGE_13 : SEC_VOLTAGE_18,
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
546 &cmd, hi_lo ? SEC_TONE_ON : SEC_TONE_OFF,
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
547 (sat_no / 4) % 2 ? SEC_MINI_B : SEC_MINI_A);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
548 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
549
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
550 #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
551
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 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
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 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
555 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
556
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 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
558 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
559 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
560
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 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
562 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
563 scmds.commands = &scmd;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
564
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
565 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
566 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
567 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
568 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
569 (((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
570 (hi_lo ? 1 : 0) |
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27863
diff changeset
571 (polv ? 0 : 2);
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
572
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 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
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 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
576 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
577 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27863
diff changeset
578
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
579 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
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 #endif
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
582
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
583 static int tune_it(int fd_frontend, int fd_sec, unsigned int freq, unsigned int srate, char pol, int tone,
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
584 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
585 fe_transmit_mode_t TransmissionMode, fe_guard_interval_t guardInterval, fe_bandwidth_t bandwidth,
18561
15fbdb09330f configurable tuning timeout
nicodvb
parents: 17012
diff changeset
586 fe_code_rate_t LP_CodeRate, fe_hierarchy_t hier, int timeout)
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
587 {
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
588 int res, hi_lo, dfd;
27370
14c5017f40d2 Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents: 26401
diff changeset
589 #ifdef CONFIG_DVB_HEAD
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
590 struct dvb_frontend_parameters feparams;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
591 struct dvb_frontend_info fe_info;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
592 #else
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
593 FrontendParameters feparams;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
594 FrontendInfo fe_info;
21815
8b2d611f3ade moved actual tuning code from check_status() to tune_it()
nicodvb
parents: 21777
diff changeset
595 FrontendEvent event;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
596 struct secStatus sec_state;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
597 #endif
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
598
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
599
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
600 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
abc080b3f63a reindented
nicodvb
parents: 21824
diff changeset
601 fd_frontend, fd_sec, (long unsigned int)freq, (long unsigned int)srate, pol, tone, diseqc);
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
602
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
603
21824
8353d81de100 init to 0 feparams before tuning
nicodvb
parents: 21816
diff changeset
604 memset(&feparams, 0, sizeof(feparams));
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
605 if ( (res = ioctl(fd_frontend,FE_GET_INFO, &fe_info) < 0))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
606 {
21825
abc080b3f63a reindented
nicodvb
parents: 21824
diff changeset
607 mp_msg(MSGT_DEMUX, MSGL_FATAL, "FE_GET_INFO FAILED\n");
abc080b3f63a reindented
nicodvb
parents: 21824
diff changeset
608 return -1;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
609 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
611
27370
14c5017f40d2 Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents: 26401
diff changeset
612 #ifdef CONFIG_DVB_HEAD
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
613 mp_msg(MSGT_DEMUX, MSGL_V, "Using DVB card \"%s\"\n", fe_info.name);
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
614 #endif
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
615
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
616 switch(fe_info.type)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
617 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
618 case FE_OFDM:
27370
14c5017f40d2 Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents: 26401
diff changeset
619 #ifdef CONFIG_DVB_HEAD
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
620 if (freq < 1000000) freq*=1000UL;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
621 feparams.frequency=freq;
11872
d158978a3d3c Compliance with the DVB power management specification (doesn't close
attila
parents: 11352
diff changeset
622 feparams.inversion=specInv;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
623 feparams.u.ofdm.bandwidth=bandwidth;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
624 feparams.u.ofdm.code_rate_HP=HP_CodeRate;
13155
fd40ef23053b added forgotten dvb-t params lp_coderate and hierarchy
nicodvb
parents: 12803
diff changeset
625 feparams.u.ofdm.code_rate_LP=LP_CodeRate;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
626 feparams.u.ofdm.constellation=modulation;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
627 feparams.u.ofdm.transmission_mode=TransmissionMode;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
628 feparams.u.ofdm.guard_interval=guardInterval;
13155
fd40ef23053b added forgotten dvb-t params lp_coderate and hierarchy
nicodvb
parents: 12803
diff changeset
629 feparams.u.ofdm.hierarchy_information=hier;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
630 #else
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
631 if (freq < 1000000) freq*=1000UL;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
632 feparams.Frequency=freq;
11872
d158978a3d3c Compliance with the DVB power management specification (doesn't close
attila
parents: 11352
diff changeset
633 feparams.Inversion=specInv;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
634 feparams.u.ofdm.bandWidth=bandwidth;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
635 feparams.u.ofdm.HP_CodeRate=HP_CodeRate;
13155
fd40ef23053b added forgotten dvb-t params lp_coderate and hierarchy
nicodvb
parents: 12803
diff changeset
636 feparams.u.ofdm.LP_CodeRate=LP_CodeRate;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
637 feparams.u.ofdm.Constellation=modulation;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
638 feparams.u.ofdm.TransmissionMode=TransmissionMode;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
639 feparams.u.ofdm.guardInterval=guardInterval;
13155
fd40ef23053b added forgotten dvb-t params lp_coderate and hierarchy
nicodvb
parents: 12803
diff changeset
640 feparams.u.ofdm.HierarchyInformation=hier;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
641 #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
642 mp_msg(MSGT_DEMUX, MSGL_V, "tuning DVB-T to %d Hz, bandwidth: %d\n",freq, bandwidth);
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
643 break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
644 case FE_QPSK:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
645 if (freq > 2200000)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
646 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
647 // this must be an absolute frequency
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
648 if (freq < SLOF)
21825
abc080b3f63a reindented
nicodvb
parents: 21824
diff changeset
649 {
27370
14c5017f40d2 Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents: 26401
diff changeset
650 #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
651 freq = feparams.frequency=(freq-LOF1);
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
652 #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
653 freq = feparams.Frequency=(freq-LOF1);
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
654 #endif
21825
abc080b3f63a reindented
nicodvb
parents: 21824
diff changeset
655 hi_lo = 0;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
656 }
21825
abc080b3f63a reindented
nicodvb
parents: 21824
diff changeset
657 else
abc080b3f63a reindented
nicodvb
parents: 21824
diff changeset
658 {
27370
14c5017f40d2 Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents: 26401
diff changeset
659 #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
660 freq = feparams.frequency=(freq-LOF2);
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
661 #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
662 freq = feparams.Frequency=(freq-LOF2);
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
663 #endif
21825
abc080b3f63a reindented
nicodvb
parents: 21824
diff changeset
664 hi_lo = 1;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
665 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
666 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
667 else
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
668 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
669 // this is an L-Band frequency
27370
14c5017f40d2 Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents: 26401
diff changeset
670 #ifdef CONFIG_DVB_HEAD
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
671 feparams.frequency=freq;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
672 #else
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
673 feparams.Frequency=freq;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
674 #endif
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
675 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
676
27370
14c5017f40d2 Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents: 26401
diff changeset
677 #ifdef CONFIG_DVB_HEAD
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
678 feparams.inversion=specInv;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
679 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
680 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
681 dfd = fd_frontend;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
682 #else
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
683 feparams.Inversion=specInv;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
684 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
685 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
686 dfd = fd_sec;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
687 #endif
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
688
21825
abc080b3f63a reindented
nicodvb
parents: 21824
diff changeset
689 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
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
690
21825
abc080b3f63a reindented
nicodvb
parents: 21824
diff changeset
691 if(do_diseqc(dfd, diseqc, (pol == 'V' ? 1 : 0), hi_lo) == 0)
abc080b3f63a reindented
nicodvb
parents: 21824
diff changeset
692 mp_msg(MSGT_DEMUX, MSGL_V, "DISEQC SETTING SUCCEDED\n");
abc080b3f63a reindented
nicodvb
parents: 21824
diff changeset
693 else
abc080b3f63a reindented
nicodvb
parents: 21824
diff changeset
694 {
abc080b3f63a reindented
nicodvb
parents: 21824
diff changeset
695 mp_msg(MSGT_DEMUX, MSGL_ERR, "DISEQC SETTING FAILED\n");
abc080b3f63a reindented
nicodvb
parents: 21824
diff changeset
696 return -1;
abc080b3f63a reindented
nicodvb
parents: 21824
diff changeset
697 }
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
698 break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
699 case FE_QAM:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
700 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
701 #ifdef CONFIG_DVB_HEAD
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
702 feparams.frequency=freq;
11872
d158978a3d3c Compliance with the DVB power management specification (doesn't close
attila
parents: 11352
diff changeset
703 feparams.inversion=specInv;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
704 feparams.u.qam.symbol_rate = srate;
11872
d158978a3d3c Compliance with the DVB power management specification (doesn't close
attila
parents: 11352
diff changeset
705 feparams.u.qam.fec_inner = HP_CodeRate;
d158978a3d3c Compliance with the DVB power management specification (doesn't close
attila
parents: 11352
diff changeset
706 feparams.u.qam.modulation = modulation;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
707 #else
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
708 feparams.Frequency=freq;
11872
d158978a3d3c Compliance with the DVB power management specification (doesn't close
attila
parents: 11352
diff changeset
709 feparams.Inversion=specInv;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
710 feparams.u.qam.SymbolRate = srate;
11872
d158978a3d3c Compliance with the DVB power management specification (doesn't close
attila
parents: 11352
diff changeset
711 feparams.u.qam.FEC_inner = HP_CodeRate;
d158978a3d3c Compliance with the DVB power management specification (doesn't close
attila
parents: 11352
diff changeset
712 feparams.u.qam.QAM = modulation;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
713 #endif
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
714 break;
14382
42d792053cde added support for ATSC tuner and conf.file
nicodvb
parents: 14282
diff changeset
715 #ifdef DVB_ATSC
42d792053cde added support for ATSC tuner and conf.file
nicodvb
parents: 14282
diff changeset
716 case FE_ATSC:
42d792053cde added support for ATSC tuner and conf.file
nicodvb
parents: 14282
diff changeset
717 mp_msg(MSGT_DEMUX, MSGL_V, "tuning ATSC to %d, modulation=%d\n",freq,modulation);
42d792053cde added support for ATSC tuner and conf.file
nicodvb
parents: 14282
diff changeset
718 feparams.frequency=freq;
42d792053cde added support for ATSC tuner and conf.file
nicodvb
parents: 14282
diff changeset
719 feparams.u.vsb.modulation = modulation;
42d792053cde added support for ATSC tuner and conf.file
nicodvb
parents: 14282
diff changeset
720 break;
42d792053cde added support for ATSC tuner and conf.file
nicodvb
parents: 14282
diff changeset
721 #endif
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
722 default:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
723 mp_msg(MSGT_DEMUX, MSGL_V, "Unknown FE type. Aborting\n");
10603
alex
parents: 10560
diff changeset
724 return 0;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
725 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
726 usleep(100000);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
727
27370
14c5017f40d2 Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents: 26401
diff changeset
728 #ifndef CONFIG_DVB_HEAD
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
729 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
730 while(1)
8b2d611f3ade moved actual tuning code from check_status() to tune_it()
nicodvb
parents: 21777
diff changeset
731 {
8b2d611f3ade moved actual tuning code from check_status() to tune_it()
nicodvb
parents: 21777
diff changeset
732 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
733 break;
8b2d611f3ade moved actual tuning code from check_status() to tune_it()
nicodvb
parents: 21777
diff changeset
734 }
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
735 #endif
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
736
21815
8b2d611f3ade moved actual tuning code from check_status() to tune_it()
nicodvb
parents: 21777
diff changeset
737 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
738 {
8b2d611f3ade moved actual tuning code from check_status() to tune_it()
nicodvb
parents: 21777
diff changeset
739 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
740 return -1;
8b2d611f3ade moved actual tuning code from check_status() to tune_it()
nicodvb
parents: 21777
diff changeset
741 }
8b2d611f3ade moved actual tuning code from check_status() to tune_it()
nicodvb
parents: 21777
diff changeset
742
29717
afc8b80eb027 cosmetics: Remove some pointless parentheses from return calls.
diego
parents: 29263
diff changeset
743 return check_status(fd_frontend, timeout);
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
744 }