annotate libmpdemux/dvb_tune.c @ 12976:79573b442def

We shouldn't translate filter names
author wight
date Mon, 09 Aug 2004 09:00:58 +0000
parents 168238f8c715
children fd40ef23053b
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
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
5 This program is free software; you can redistribute it and/or
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
6 modify it under the terms of the GNU General Public License
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
7 as published by the Free Software Foundation; either version 2
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
8 of the License, or (at your option) any later version.
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
9
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
10 This program is distributed in the hope that it will be useful,
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
13 GNU General Public License for more details.
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
14
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
15 You should have received a copy of the GNU General Public License
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
16 along with this program; if not, write to the Free Software
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
18 Or, point your browser to http://www.gnu.org/copyleft/gpl.html
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
19
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
20 */
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
21
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
22 #include <stdio.h>
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
23 #include <stdlib.h>
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
24 #include <ctype.h>
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
25 #include <sys/ioctl.h>
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
26 #include <sys/poll.h>
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
27 #include <unistd.h>
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
28 #include <fcntl.h>
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
29 #include <error.h>
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
30 #include <errno.h>
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
31 #include "config.h"
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
32
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
33 #ifdef HAVE_DVB_HEAD
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
34 #include <linux/dvb/dmx.h>
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
35 #include <linux/dvb/frontend.h>
11872
d158978a3d3c Compliance with the DVB power management specification (doesn't close
attila
parents: 11352
diff changeset
36 char* dvb_frontenddev[4]={"/dev/dvb/adapter0/frontend0","/dev/dvb/adapter1/frontend0","/dev/dvb/adapter2/frontend0","/dev/dvb/adapter3/frontend0"};
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
37 char* dvb_dvrdev[4]={"/dev/dvb/adapter0/dvr0","/dev/dvb/adapter1/dvr0","/dev/dvb/adapter2/dvr0","/dev/dvb/adapter3/dvr0"};
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
38 char* dvb_demuxdev[4]={"/dev/dvb/adapter0/demux0","/dev/dvb/adapter1/demux0","/dev/dvb/adapter2/demux0","/dev/dvb/adapter3/demux0"};
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
39 static char* dvb_secdev[4]={"","","",""}; //UNUSED, ONLY FOR UNIFORMITY
9610
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>
11872
d158978a3d3c Compliance with the DVB power management specification (doesn't close
attila
parents: 11352
diff changeset
44 char* dvb_frontenddev[4]={"/dev/ost/frontend0","/dev/ost/frontend1","/dev/ost/frontend2","/dev/ost/frontend3"};
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
45 char* dvb_dvrdev[4]={"/dev/ost/dvr0","/dev/ost/dvr1","/dev/ost/dvr2","/dev/ost/dvr3"};
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
46 static char* dvb_secdev[4]={"/dev/ost/sec0","/dev/ost/sec1","/dev/ost/sec2","/dev/ost/sec3"};
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
47 char* dvb_demuxdev[4]={"/dev/ost/demux0","/dev/ost/demux1","/dev/ost/demux2","/dev/ost/demux3"};
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
48 #endif
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
49
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
50 #include "dvbin.h"
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
51 #include "../mp_msg.h"
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
52
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
53
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
54
12309
5c375ea5fb0f new configuration structure, gcc warn silencing
nicodvb
parents: 12048
diff changeset
55 int dvb_get_tuner_type(int fe_fd)
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
56 {
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
57 #ifdef HAVE_DVB_HEAD
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
58 struct dvb_frontend_info fe_info;
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
59 #else
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
60 FrontendInfo fe_info;
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
61 #endif
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
62
12309
5c375ea5fb0f new configuration structure, gcc warn silencing
nicodvb
parents: 12048
diff changeset
63 int res;
11872
d158978a3d3c Compliance with the DVB power management specification (doesn't close
attila
parents: 11352
diff changeset
64
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
65 res = ioctl(fe_fd, FE_GET_INFO, &fe_info);
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
66 if(res < 0)
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
67 {
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
68 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
69 return 0;
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
70 }
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
71
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
72 switch(fe_info.type)
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
73 {
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
74 case FE_OFDM:
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-T\n");
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
76 return TUNER_TER;
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
77
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
78 case FE_QPSK:
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-S\n");
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
80 return TUNER_SAT;
11872
d158978a3d3c Compliance with the DVB power management specification (doesn't close
attila
parents: 11352
diff changeset
81
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
82 case FE_QAM:
12309
5c375ea5fb0f new configuration structure, gcc warn silencing
nicodvb
parents: 12048
diff changeset
83 mp_msg(MSGT_DEMUX, MSGL_V, "TUNER TYPE SEEMS TO BE DVB-C\n");
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
84 return TUNER_CBL;
11872
d158978a3d3c Compliance with the DVB power management specification (doesn't close
attila
parents: 11352
diff changeset
85
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
86 default:
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
87 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
88 return 0;
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
89 }
11872
d158978a3d3c Compliance with the DVB power management specification (doesn't close
attila
parents: 11352
diff changeset
90
d158978a3d3c Compliance with the DVB power management specification (doesn't close
attila
parents: 11352
diff changeset
91 }
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
92
12803
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
93 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
94
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
95 int dvb_open_devices(dvb_priv_t *priv, int n, int demux_cnt, int *pids)
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
96 {
12803
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
97 int i;
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
98
12309
5c375ea5fb0f new configuration structure, gcc warn silencing
nicodvb
parents: 12048
diff changeset
99 priv->fe_fd = open(dvb_frontenddev[n], O_RDWR | O_NONBLOCK);
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
100 if(priv->fe_fd < 0)
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
101 {
12309
5c375ea5fb0f new configuration structure, gcc warn silencing
nicodvb
parents: 12048
diff changeset
102 mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR OPENING FRONTEND DEVICE %s: ERRNO %d\n", dvb_frontenddev[n], errno);
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
103 return 0;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
104 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
105 #ifdef HAVE_DVB_HEAD
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
106 priv->sec_fd=0;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
107 #else
12309
5c375ea5fb0f new configuration structure, gcc warn silencing
nicodvb
parents: 12048
diff changeset
108 priv->sec_fd = open(dvb_secdev[n], O_RDWR);
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
109 if(priv->sec_fd < 0)
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
110 {
12309
5c375ea5fb0f new configuration structure, gcc warn silencing
nicodvb
parents: 12048
diff changeset
111 mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR OPENING SEC DEVICE %s: ERRNO %d\n", dvb_secdev[n], errno);
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
112 close(priv->fe_fd);
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
113 return 0;
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
114 }
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
115 #endif
12803
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
116 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
117 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
118 for(i = 0; i < demux_cnt; i++)
12309
5c375ea5fb0f new configuration structure, gcc warn silencing
nicodvb
parents: 12048
diff changeset
119 {
12803
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
120 priv->demux_fds[i] = open(dvb_demuxdev[n], O_RDWR | O_NONBLOCK);
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
121 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
122 {
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
123 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
124 return 0;
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
125 }
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
126 else
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
127 {
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
128 mp_msg(MSGT_DEMUX, MSGL_V, "OPEN(%d), file %s: FD=%d, CNT=%d\n", i, dvb_demuxdev[n], priv->demux_fds[i], 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
129 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
130 }
12309
5c375ea5fb0f new configuration structure, gcc warn silencing
nicodvb
parents: 12048
diff changeset
131 }
5c375ea5fb0f new configuration structure, gcc warn silencing
nicodvb
parents: 12048
diff changeset
132
5c375ea5fb0f new configuration structure, gcc warn silencing
nicodvb
parents: 12048
diff changeset
133
5c375ea5fb0f new configuration structure, gcc warn silencing
nicodvb
parents: 12048
diff changeset
134 priv->dvr_fd = open(dvb_dvrdev[n], O_RDONLY| O_NONBLOCK);
5c375ea5fb0f new configuration structure, gcc warn silencing
nicodvb
parents: 12048
diff changeset
135 if(priv->dvr_fd < 0)
5c375ea5fb0f new configuration structure, gcc warn silencing
nicodvb
parents: 12048
diff changeset
136 {
5c375ea5fb0f new configuration structure, gcc warn silencing
nicodvb
parents: 12048
diff changeset
137 mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR OPENING DVR DEVICE %s: %d\n", dvb_dvrdev[n], errno);
5c375ea5fb0f new configuration structure, gcc warn silencing
nicodvb
parents: 12048
diff changeset
138 return 0;
5c375ea5fb0f new configuration structure, gcc warn silencing
nicodvb
parents: 12048
diff changeset
139 }
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
140
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
141 return 1;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
142 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
143
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
144
12803
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
145 int dvb_fix_demuxes(dvb_priv_t *priv, int cnt, int *pids)
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
146 {
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
147 int i;
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
148
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
149 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
150 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
151 {
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
152 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
153 {
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
154 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
155 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
156 }
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
157 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
158 }
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
159 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
160 {
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
161 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
162 {
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
163 priv->demux_fds[i] = open(dvb_demuxdev[priv->card], O_RDWR | O_NONBLOCK);
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
164 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
165 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
166 {
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
167 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
168 return 0;
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
169 }
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
170 else
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
171 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
172 }
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
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
175 return 1;
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
176 }
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
177
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
178 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
179 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
180 int i;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
181 struct dmx_pes_filter_params pesFilterParams;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
182
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
183 pesFilterParams.pid = pid;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
184 pesFilterParams.input = DMX_IN_FRONTEND;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
185 pesFilterParams.output = DMX_OUT_TS_TAP;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
186 #ifdef HAVE_DVB_HEAD
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
187 pesFilterParams.pes_type = pestype;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
188 #else
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
189 pesFilterParams.pesType = pestype;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
190 #endif
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
191
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
192 pesFilterParams.flags = DMX_IMMEDIATE_START;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
193
12803
168238f8c715 added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
nicodvb
parents: 12309
diff changeset
194 errno = 0;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
195 if ((i = ioctl(fd, DMX_SET_PES_FILTER, &pesFilterParams)) < 0)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
196 {
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
197 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
198 return 0;
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
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
201 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
202 return 1;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
203 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
204
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
205
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
206 int dvb_demux_stop(int fd)
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
207 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
208 int i;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
209 i = ioctl(fd, DMX_STOP);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
210
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
211 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
212
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
213 return (i==0);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
214 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
215
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
216
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
217 int dvb_demux_start(int fd)
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
218 {
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
219 int i;
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
220 i = ioctl(fd, DMX_START);
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
221
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
222 mp_msg(MSGT_DEMUX, MSGL_DBG2, "STARTING FD: %d, RESULT: %d\n", fd, i);
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
223
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
224 return (i==0);
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
225 }
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
226
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
227
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
228 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
229 fe_spectral_inversion_t specInv, unsigned int diseqc, fe_modulation_t modulation, fe_code_rate_t HP_CodeRate,
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
230 fe_transmit_mode_t TransmissionMode, fe_guard_interval_t guardInterval, fe_bandwidth_t bandwidth);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
231
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
232
12309
5c375ea5fb0f new configuration structure, gcc warn silencing
nicodvb
parents: 12048
diff changeset
233 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
234 fe_spectral_inversion_t specInv, fe_modulation_t modulation, fe_guard_interval_t guardInterval,
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
235 fe_transmit_mode_t TransmissionMode, fe_bandwidth_t bandWidth, fe_code_rate_t HP_CodeRate)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
236 {
11872
d158978a3d3c Compliance with the DVB power management specification (doesn't close
attila
parents: 11352
diff changeset
237 int ris;
d158978a3d3c Compliance with the DVB power management specification (doesn't close
attila
parents: 11352
diff changeset
238
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
239 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
240
d158978a3d3c Compliance with the DVB power management specification (doesn't close
attila
parents: 11352
diff changeset
241 ris = tune_it(priv->fe_fd, priv->sec_fd, freq, srate, pol, tone, specInv, diseqc, modulation, HP_CodeRate, TransmissionMode, guardInterval, bandWidth);
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
242
11872
d158978a3d3c Compliance with the DVB power management specification (doesn't close
attila
parents: 11352
diff changeset
243 if(ris != 0)
d158978a3d3c Compliance with the DVB power management specification (doesn't close
attila
parents: 11352
diff changeset
244 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
245
d158978a3d3c Compliance with the DVB power management specification (doesn't close
attila
parents: 11352
diff changeset
246 return (ris == 0);
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
247 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
248
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
249
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
250 #ifndef HAVE_DVB_HEAD
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
251 static int SecGetStatus (int fd, struct secStatus *state)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
252 {
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
253 if(ioctl(fd, SEC_GET_STATUS, state) < 0)
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
254 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
255 mp_msg(MSGT_DEMUX, MSGL_ERR, ("SEC GET STATUS: "));
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
256 return -1;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
257 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
258
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
259 switch (state->busMode)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
260 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
261 case SEC_BUS_IDLE:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
262 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
263 break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
264 case SEC_BUS_BUSY:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
265 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
266 break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
267 case SEC_BUS_OFF:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
268 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
269 break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
270 case SEC_BUS_OVERLOAD:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
271 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
272 break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
273 default:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
274 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
275 break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
276 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
277
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
278 switch (state->selVolt)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
279 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
280 case SEC_VOLTAGE_OFF:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
281 mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: OFF (%d)\n",state->selVolt);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
282 break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
283 case SEC_VOLTAGE_LT:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
284 mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: LT (%d)\n",state->selVolt);
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_VOLTAGE_13:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
287 mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: 13 (%d)\n",state->selVolt);
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_VOLTAGE_13_5:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
290 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
291 break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
292 case SEC_VOLTAGE_18:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
293 mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: 18 (%d)\n",state->selVolt);
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 case SEC_VOLTAGE_18_5:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
296 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
297 break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
298 default:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
299 mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: unknown (%d)\n",state->selVolt);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
300 break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
301 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
302
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
303 mp_msg(MSGT_DEMUX, MSGL_V, "SEC CONT TONE: %s\n", (state->contTone == SEC_TONE_ON ? "ON" : "OFF"));
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
304 return 0;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
305 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
306
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
307 #endif
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
308
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
309 static void print_status(fe_status_t festatus)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
310 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
311 mp_msg(MSGT_DEMUX, MSGL_V, "FE_STATUS:");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
312 if (festatus & FE_HAS_SIGNAL) mp_msg(MSGT_DEMUX, MSGL_V," FE_HAS_SIGNAL");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
313 #ifdef HAVE_DVB_HEAD
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
314 if (festatus & FE_TIMEDOUT) mp_msg(MSGT_DEMUX, MSGL_V, " FE_TIMEDOUT");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
315 #else
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
316 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
317 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
318 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
319 #endif
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
320 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
321 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
322 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
323 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
324 mp_msg(MSGT_DEMUX, MSGL_V, "\n");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
325 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
326
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
327
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
328 #ifdef HAVE_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
329 static int check_status(int fd_frontend,struct dvb_frontend_parameters* feparams, int tuner_type, uint32_t base)
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
330 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
331 int32_t strength;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
332 fe_status_t festatus;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
333 struct dvb_frontend_event event;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
334 struct pollfd pfd[1];
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
335
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
336 while(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
337 {
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
338 if (ioctl(fd_frontend, FE_GET_EVENT, &event) < 0) //EMPTY THE EVENT QUEUE
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
339 break;
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
340 }
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
341
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
342 if (ioctl(fd_frontend,FE_SET_FRONTEND,feparams) < 0)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
343 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
344 mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR tuning channel\n");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
345 return -1;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
346 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
347
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
348 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
349 pfd[0].events = POLLPRI;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
350
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
351 event.status=0;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
352 while (((event.status & FE_TIMEDOUT)==0) && ((event.status & FE_HAS_LOCK)==0))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
353 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
354 mp_msg(MSGT_DEMUX, MSGL_V, "polling....\n");
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
355 if(poll(pfd,1,10000) > 0)
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
356 {
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
357 if (pfd[0].revents & POLLPRI)
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
358 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
359 mp_msg(MSGT_DEMUX, MSGL_V, "Getting frontend event\n");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
360 if ( ioctl(fd_frontend, FE_GET_EVENT, &event) < 0)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
361 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
362 mp_msg(MSGT_DEMUX, MSGL_ERR, "FE_GET_EVENT");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
363 return -1;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
364 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
365 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
366 print_status(event.status);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
367 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
368 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
369
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
370 if(event.status & FE_HAS_LOCK)
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
371 {
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
372 switch(tuner_type)
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
373 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
374 case FE_OFDM:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
375 mp_msg(MSGT_DEMUX, MSGL_V, "Event: Frequency: %d\n",event.parameters.frequency);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
376 break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
377 case FE_QPSK:
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
378 mp_msg(MSGT_DEMUX, MSGL_V, "Event: Frequency: %d\n",(unsigned int)((event.parameters.frequency)+base));
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
379 mp_msg(MSGT_DEMUX, MSGL_V, " SymbolRate: %d\n",event.parameters.u.qpsk.symbol_rate);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
380 mp_msg(MSGT_DEMUX, MSGL_V, " FEC_inner: %d\n",event.parameters.u.qpsk.fec_inner);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
381 mp_msg(MSGT_DEMUX, MSGL_V, "\n");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
382 break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
383 case FE_QAM:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
384 mp_msg(MSGT_DEMUX, MSGL_V, "Event: Frequency: %d\n",event.parameters.frequency);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
385 mp_msg(MSGT_DEMUX, MSGL_V, " SymbolRate: %d\n",event.parameters.u.qpsk.symbol_rate);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
386 mp_msg(MSGT_DEMUX, MSGL_V, " FEC_inner: %d\n",event.parameters.u.qpsk.fec_inner);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
387 break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
388 default:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
389 break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
390 }
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_BER,&strength) >= 0)
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
394 mp_msg(MSGT_DEMUX, MSGL_V, "Bit error rate: %d\n",strength);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
395
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
396 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
397 if(ioctl(fd_frontend,FE_READ_SIGNAL_STRENGTH,&strength) >= 0)
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
398 mp_msg(MSGT_DEMUX, MSGL_V, "Signal strength: %d\n",strength);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
399
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
400 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
401 if(ioctl(fd_frontend,FE_READ_SNR,&strength) >= 0)
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
402 mp_msg(MSGT_DEMUX, MSGL_V, "SNR: %d\n",strength);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
403
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
404 festatus=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
405 if(ioctl(fd_frontend,FE_READ_STATUS,&festatus) >= 0)
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
406 print_status(festatus);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
407 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
408 else
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
409 {
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
410 mp_msg(MSGT_DEMUX, MSGL_ERR, "Not able to lock to the signal on the given frequency\n");
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
411 return -1;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
412 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
413 return 0;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
414 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
415
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
416 #else
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
417
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
418 static int check_status(int fd_frontend,FrontendParameters* feparams,int tuner_type,uint32_t base)
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
419 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
420 int i,res;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
421 int32_t strength;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
422 fe_status_t festatus;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
423 FrontendEvent event;
12048
09aae06de9c8 removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents: 11872
diff changeset
424
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
425 struct pollfd pfd[1];
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
426
12048
09aae06de9c8 removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents: 11872
diff changeset
427 while(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
428 {
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(ioctl(fd_frontend, FE_GET_EVENT, &event) == -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
430 break;
09aae06de9c8 removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents: 11872
diff changeset
431 }
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
432
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
433 i = 0; res = -1;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
434 while ((i < 3) && (res < 0))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
435 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
436 if (ioctl(fd_frontend,FE_SET_FRONTEND,feparams) < 0)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
437 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
438 mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR tuning channel\n");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
439 return -1;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
440 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
441
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
442 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
443 pfd[0].events = POLLIN | POLLPRI;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
444
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
445 if(poll(pfd,1,10000) > 0)
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
446 {
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
447 if (pfd[0].revents & POLLPRI)
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
448 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
449 mp_msg(MSGT_DEMUX, MSGL_V, "Getting frontend event\n");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
450 if ( ioctl(fd_frontend, FE_GET_EVENT, &event) < 0)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
451 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
452 mp_msg(MSGT_DEMUX, MSGL_ERR, "FE_GET_EVENT");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
453 return -1;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
454 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
455 mp_msg(MSGT_DEMUX, MSGL_V, "Received ");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
456 switch(event.type)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
457 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
458 case FE_UNEXPECTED_EV:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
459 mp_msg(MSGT_DEMUX, MSGL_V, "unexpected event\n");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
460 res = -1;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
461 break;
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_FAILURE_EV:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
464 mp_msg(MSGT_DEMUX, MSGL_V, "failure event\n");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
465 res = -1;
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
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
468 case FE_COMPLETION_EV:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
469 mp_msg(MSGT_DEMUX, MSGL_V, "completion event\n");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
470 res = 0;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
471 break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
472 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
473 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
474 i++;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
475 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
476 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
477
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
478 if (res > 0)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
479 switch (event.type)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
480 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
481 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
482 break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
483 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
484 break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
485 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
486 break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
487 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
488
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
489 if (event.type == FE_COMPLETION_EV)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
490 {
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
491 switch(tuner_type)
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
492 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
493 case FE_OFDM:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
494 mp_msg(MSGT_DEMUX, MSGL_V, "Event: Frequency: %d\n",event.u.completionEvent.Frequency);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
495 break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
496
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
497 case FE_QPSK:
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
498 mp_msg(MSGT_DEMUX, MSGL_V, "Event: Frequency: %d\n",(unsigned int)((event.u.completionEvent.Frequency)+base));
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
499 mp_msg(MSGT_DEMUX, MSGL_V, " SymbolRate: %d\n",event.u.completionEvent.u.qpsk.SymbolRate);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
500 mp_msg(MSGT_DEMUX, MSGL_V, " FEC_inner: %d\n",event.u.completionEvent.u.qpsk.FEC_inner);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
501 mp_msg(MSGT_DEMUX, MSGL_V, "\n");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
502 break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
503
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
504 case FE_QAM:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
505 mp_msg(MSGT_DEMUX, MSGL_V, "Event: Frequency: %d\n",event.u.completionEvent.Frequency);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
506 mp_msg(MSGT_DEMUX, MSGL_V, " SymbolRate: %d\n",event.u.completionEvent.u.qpsk.SymbolRate);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
507 mp_msg(MSGT_DEMUX, MSGL_V, " FEC_inner: %d\n",event.u.completionEvent.u.qpsk.FEC_inner);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
508 break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
509
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
510 default:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
511 break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
512 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
513
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
514 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
515 if(ioctl(fd_frontend,FE_READ_BER,&strength) >= 0)
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
516 mp_msg(MSGT_DEMUX, MSGL_V, "Bit error rate: %d\n",strength);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
517
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
518 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
519 if(ioctl(fd_frontend,FE_READ_SIGNAL_STRENGTH,&strength) >= 0)
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
520 mp_msg(MSGT_DEMUX, MSGL_V, "Signal strength: %d\n",strength);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
521
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
522 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
523 if(ioctl(fd_frontend,FE_READ_SNR,&strength) >= 0)
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
524 mp_msg(MSGT_DEMUX, MSGL_V, "SNR: %d\n",strength);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
525
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
526 festatus=0;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
527 mp_msg(MSGT_DEMUX, MSGL_V, "FE_STATUS:");
12048
09aae06de9c8 removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents: 11872
diff changeset
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 if(ioctl(fd_frontend,FE_READ_STATUS,&festatus) >= 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
530 print_status(festatus);
09aae06de9c8 removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents: 11872
diff changeset
531 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
532 mp_msg(MSGT_DEMUX, MSGL_ERR, " ERROR, UNABLE TO READ_STATUS");
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
533
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
534 mp_msg(MSGT_DEMUX, MSGL_V, "\n");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
535 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
536 else
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
537 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
538 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
539 return -1;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
540 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
541 return 0;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
542 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
543 #endif
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
544
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
545 #ifdef HAVE_DVB_HEAD
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
546
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
547 static struct diseqc_cmd {
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
548 struct dvb_diseqc_master_cmd cmd;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
549 uint32_t wait;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
550 };
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
551
12048
09aae06de9c8 removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents: 11872
diff changeset
552 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
553 fe_sec_tone_mode_t t, fe_sec_mini_cmd_t b)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
554 {
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
555 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
556 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
557 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
558 return -1;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
559 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
560 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
561 return -1;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
562 usleep(cmd->wait * 1000);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
563 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
564 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
565 return -1;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
566 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
567 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
568 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
569
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 return 0;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
571 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
572
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
573 /* digital satellite equipment control,
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
574 * specification is available from http://www.eutelsat.com/
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
575 */
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
576 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
577 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
578 struct diseqc_cmd cmd = { {{0xe0, 0x10, 0x38, 0xf0, 0x00, 0x00}, 4}, 0 };
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
579
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
580 /* param: high nibble: reset bits, low nibble set bits,
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
581 * bits are: option, position, polarizaion, band
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
582 */
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
583 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
584 0xf0 | (((sat_no * 4) & 0x0f) | (hi_lo ? 1 : 0) | (polv ? 0 : 2));
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
585
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
586 return diseqc_send_msg(secfd, polv ? SEC_VOLTAGE_13 : SEC_VOLTAGE_18,
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
587 &cmd, hi_lo ? SEC_TONE_ON : SEC_TONE_OFF,
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
588 (sat_no / 4) % 2 ? SEC_MINI_B : SEC_MINI_A);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
589 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
590
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
591 #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
592
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
593 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
594 {
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
595 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
596 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
597
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
598 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
599 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
600 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
601
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
602 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
603 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
604 scmds.commands = &scmd;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
605
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
606 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
607 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
608 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
609 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
610 (((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
611 (hi_lo ? 1 : 0) |
09aae06de9c8 removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents: 11872
diff changeset
612 (polv ? 0 : 2);
09aae06de9c8 removed unused code, synced to szap tuning sequence and unified diseqc, tone and voltage in a (non/old)-diseqc compatible function
nicodvb
parents: 11872
diff changeset
613
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
614 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
615 {
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
616 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
617 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
618 }
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
619
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
620 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
621 }
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
622 #endif
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
623
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
624 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
625 fe_spectral_inversion_t specInv, unsigned int diseqc, fe_modulation_t modulation, fe_code_rate_t HP_CodeRate,
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
626 fe_transmit_mode_t TransmissionMode, fe_guard_interval_t guardInterval, fe_bandwidth_t bandwidth)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
627 {
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
628 int res, hi_lo, dfd;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
629 #ifdef HAVE_DVB_HEAD
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
630 struct dvb_frontend_parameters feparams;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
631 struct dvb_frontend_info fe_info;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
632 #else
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
633 FrontendParameters feparams;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
634 FrontendInfo fe_info;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
635 struct secStatus sec_state;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
636 #endif
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
637
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
638
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
639 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",
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
640 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
641
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
642
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
643 if ( (res = ioctl(fd_frontend,FE_GET_INFO, &fe_info) < 0))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
644 {
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
645 mp_msg(MSGT_DEMUX, MSGL_FATAL, "FE_GET_INFO FAILED\n");
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
646 return -1;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
647 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
648
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
649
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
650 #ifdef HAVE_DVB_HEAD
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
651 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
652 #endif
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
653
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
654 switch(fe_info.type)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
655 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
656 case FE_OFDM:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
657 #ifdef HAVE_DVB_HEAD
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
658 if (freq < 1000000) freq*=1000UL;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
659 feparams.frequency=freq;
11872
d158978a3d3c Compliance with the DVB power management specification (doesn't close
attila
parents: 11352
diff changeset
660 feparams.inversion=specInv;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
661 feparams.u.ofdm.bandwidth=bandwidth;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
662 feparams.u.ofdm.code_rate_HP=HP_CodeRate;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
663 feparams.u.ofdm.code_rate_LP=LP_CODERATE_DEFAULT;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
664 feparams.u.ofdm.constellation=modulation;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
665 feparams.u.ofdm.transmission_mode=TransmissionMode;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
666 feparams.u.ofdm.guard_interval=guardInterval;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
667 feparams.u.ofdm.hierarchy_information=HIERARCHY_DEFAULT;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
668 #else
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
669 if (freq < 1000000) freq*=1000UL;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
670 feparams.Frequency=freq;
11872
d158978a3d3c Compliance with the DVB power management specification (doesn't close
attila
parents: 11352
diff changeset
671 feparams.Inversion=specInv;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
672 feparams.u.ofdm.bandWidth=bandwidth;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
673 feparams.u.ofdm.HP_CodeRate=HP_CodeRate;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
674 feparams.u.ofdm.LP_CodeRate=LP_CODERATE_DEFAULT;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
675 feparams.u.ofdm.Constellation=modulation;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
676 feparams.u.ofdm.TransmissionMode=TransmissionMode;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
677 feparams.u.ofdm.guardInterval=guardInterval;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
678 feparams.u.ofdm.HierarchyInformation=HIERARCHY_DEFAULT;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
679 #endif
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 mp_msg(MSGT_DEMUX, MSGL_V, "tuning DVB-T (%s) to %d Hz, bandwidth: %d\n",DVB_T_LOCATION,freq, bandwidth);
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
681 break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
682 case FE_QPSK:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
683 if (freq > 2200000)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
684 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
685 // this must be an absolute frequency
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
686 if (freq < SLOF)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
687 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
688 #ifdef HAVE_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
689 freq = feparams.frequency=(freq-LOF1);
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
690 #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
691 freq = feparams.Frequency=(freq-LOF1);
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
692 #endif
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
693 hi_lo = 0;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
694 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
695 else
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
696 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
697 #ifdef HAVE_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
698 freq = feparams.frequency=(freq-LOF2);
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
699 #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
700 freq = feparams.Frequency=(freq-LOF2);
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
701 #endif
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
702 hi_lo = 1;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
703 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
704 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
705 else
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
706 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
707 // this is an L-Band frequency
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
708 #ifdef HAVE_DVB_HEAD
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
709 feparams.frequency=freq;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
710 #else
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
711 feparams.Frequency=freq;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
712 #endif
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
713 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
714
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
715 #ifdef HAVE_DVB_HEAD
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
716 feparams.inversion=specInv;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
717 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
718 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
719 dfd = fd_frontend;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
720 #else
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
721 feparams.Inversion=specInv;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
722 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
723 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
724 dfd = fd_sec;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
725 #endif
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
726
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
727 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
728
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
729 if(do_diseqc(dfd, diseqc, (pol == 'V' ? 1 : 0), hi_lo) == 0)
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
730 mp_msg(MSGT_DEMUX, MSGL_V, "DISEQC SETTING SUCCEDED\n");
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
731 else
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
732 {
10560
11826d9f90c7 this patch fixes
arpi
parents: 9610
diff changeset
733 mp_msg(MSGT_DEMUX, MSGL_ERR, "DISEQC SETTING FAILED\n");
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
734 return -1;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
735 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
736 break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
737 case FE_QAM:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
738 mp_msg(MSGT_DEMUX, MSGL_V, "tuning DVB-C to %d, srate=%d\n",freq,srate);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
739 #ifdef HAVE_DVB_HEAD
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
740 feparams.frequency=freq;
11872
d158978a3d3c Compliance with the DVB power management specification (doesn't close
attila
parents: 11352
diff changeset
741 feparams.inversion=specInv;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
742 feparams.u.qam.symbol_rate = srate;
11872
d158978a3d3c Compliance with the DVB power management specification (doesn't close
attila
parents: 11352
diff changeset
743 feparams.u.qam.fec_inner = HP_CodeRate;
d158978a3d3c Compliance with the DVB power management specification (doesn't close
attila
parents: 11352
diff changeset
744 feparams.u.qam.modulation = modulation;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
745 #else
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
746 feparams.Frequency=freq;
11872
d158978a3d3c Compliance with the DVB power management specification (doesn't close
attila
parents: 11352
diff changeset
747 feparams.Inversion=specInv;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
748 feparams.u.qam.SymbolRate = srate;
11872
d158978a3d3c Compliance with the DVB power management specification (doesn't close
attila
parents: 11352
diff changeset
749 feparams.u.qam.FEC_inner = HP_CodeRate;
d158978a3d3c Compliance with the DVB power management specification (doesn't close
attila
parents: 11352
diff changeset
750 feparams.u.qam.QAM = modulation;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
751 #endif
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
752 break;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
753 default:
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
754 mp_msg(MSGT_DEMUX, MSGL_V, "Unknown FE type. Aborting\n");
10603
alex
parents: 10560
diff changeset
755 return 0;
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
756 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
757 usleep(100000);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
758
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
759 #ifndef HAVE_DVB_HEAD
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
760 if (fd_sec) SecGetStatus(fd_sec, &sec_state);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
761 #endif
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
762
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
763 return(check_status(fd_frontend,&feparams,fe_info.type, (hi_lo ? LOF2 : LOF1)));
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents:
diff changeset
764 }