Mercurial > mplayer.hg
comparison libmpdemux/dvb_tune.c @ 12803:168238f8c715
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
author | nicodvb |
---|---|
date | Mon, 12 Jul 2004 20:52:02 +0000 |
parents | 5c375ea5fb0f |
children | fd40ef23053b |
comparison
equal
deleted
inserted
replaced
12802:af5a4cc17170 | 12803:168238f8c715 |
---|---|
88 return 0; | 88 return 0; |
89 } | 89 } |
90 | 90 |
91 } | 91 } |
92 | 92 |
93 int dvb_open_devices(dvb_priv_t *priv, int n) | 93 int dvb_set_ts_filt(int fd, uint16_t pid, dmx_pes_type_t pestype); |
94 { | 94 |
95 int dvb_open_devices(dvb_priv_t *priv, int n, int demux_cnt, int *pids) | |
96 { | |
97 int i; | |
98 | |
95 priv->fe_fd = open(dvb_frontenddev[n], O_RDWR | O_NONBLOCK); | 99 priv->fe_fd = open(dvb_frontenddev[n], O_RDWR | O_NONBLOCK); |
96 if(priv->fe_fd < 0) | 100 if(priv->fe_fd < 0) |
97 { | 101 { |
98 mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR OPENING FRONTEND DEVICE %s: ERRNO %d\n", dvb_frontenddev[n], errno); | 102 mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR OPENING FRONTEND DEVICE %s: ERRNO %d\n", dvb_frontenddev[n], errno); |
99 return 0; | 103 return 0; |
107 mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR OPENING SEC DEVICE %s: ERRNO %d\n", dvb_secdev[n], errno); | 111 mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR OPENING SEC DEVICE %s: ERRNO %d\n", dvb_secdev[n], errno); |
108 close(priv->fe_fd); | 112 close(priv->fe_fd); |
109 return 0; | 113 return 0; |
110 } | 114 } |
111 #endif | 115 #endif |
112 priv->demux_fd[0] = open(dvb_demuxdev[n], O_RDWR); | 116 priv->demux_fds_cnt = 0; |
113 if(priv->demux_fd[0] < 0) | 117 mp_msg(MSGT_DEMUX, MSGL_V, "DVB_OPEN_DEVICES(%d)\n", demux_cnt); |
114 { | 118 for(i = 0; i < demux_cnt; i++) |
115 mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR OPENING DEMUX 0: %d\n", errno); | 119 { |
116 return 0; | 120 priv->demux_fds[i] = open(dvb_demuxdev[n], O_RDWR | O_NONBLOCK); |
117 } | 121 if(priv->demux_fds[i] < 0) |
118 | 122 { |
119 priv->demux_fd[1] = open(dvb_demuxdev[n], O_RDWR); | 123 mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR OPENING DEMUX 0: %d\n", errno); |
120 if(priv->demux_fd[1] < 0) | 124 return 0; |
121 { | 125 } |
122 mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR OPENING DEMUX 1: %d\n", errno); | 126 else |
123 return 0; | 127 { |
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); | |
129 priv->demux_fds_cnt++; | |
130 } | |
124 } | 131 } |
125 | 132 |
126 | 133 |
127 priv->dvr_fd = open(dvb_dvrdev[n], O_RDONLY| O_NONBLOCK); | 134 priv->dvr_fd = open(dvb_dvrdev[n], O_RDONLY| O_NONBLOCK); |
128 if(priv->dvr_fd < 0) | 135 if(priv->dvr_fd < 0) |
133 | 140 |
134 return 1; | 141 return 1; |
135 } | 142 } |
136 | 143 |
137 | 144 |
145 int dvb_fix_demuxes(dvb_priv_t *priv, int cnt, int *pids) | |
146 { | |
147 int i; | |
148 | |
149 mp_msg(MSGT_DEMUX, MSGL_V, "FIX %d -> %d\n", priv->demux_fds_cnt, cnt); | |
150 if(priv->demux_fds_cnt >= cnt) | |
151 { | |
152 for(i = priv->demux_fds_cnt-1; i >= cnt; i--) | |
153 { | |
154 mp_msg(MSGT_DEMUX, MSGL_V, "FIX, CLOSE fd(%d): %d\n", i, priv->demux_fds[i]); | |
155 close(priv->demux_fds[i]); | |
156 } | |
157 priv->demux_fds_cnt = cnt; | |
158 } | |
159 else if(priv->demux_fds_cnt < cnt) | |
160 { | |
161 for(i = priv->demux_fds_cnt; i < cnt; i++) | |
162 { | |
163 priv->demux_fds[i] = open(dvb_demuxdev[priv->card], O_RDWR | O_NONBLOCK); | |
164 mp_msg(MSGT_DEMUX, MSGL_V, "FIX, OPEN fd(%d): %d\n", i, priv->demux_fds[i]); | |
165 if(priv->demux_fds[i] < 0) | |
166 { | |
167 mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR OPENING DEMUX 0: %d\n", errno); | |
168 return 0; | |
169 } | |
170 else | |
171 priv->demux_fds_cnt++; | |
172 } | |
173 } | |
174 | |
175 return 1; | |
176 } | |
138 | 177 |
139 int dvb_set_ts_filt(int fd, uint16_t pid, dmx_pes_type_t pestype) | 178 int dvb_set_ts_filt(int fd, uint16_t pid, dmx_pes_type_t pestype) |
140 { | 179 { |
141 int i; | 180 int i; |
142 struct dmx_pes_filter_params pesFilterParams; | 181 struct dmx_pes_filter_params pesFilterParams; |
150 pesFilterParams.pesType = pestype; | 189 pesFilterParams.pesType = pestype; |
151 #endif | 190 #endif |
152 | 191 |
153 pesFilterParams.flags = DMX_IMMEDIATE_START; | 192 pesFilterParams.flags = DMX_IMMEDIATE_START; |
154 | 193 |
194 errno = 0; | |
155 if ((i = ioctl(fd, DMX_SET_PES_FILTER, &pesFilterParams)) < 0) | 195 if ((i = ioctl(fd, DMX_SET_PES_FILTER, &pesFilterParams)) < 0) |
156 { | 196 { |
157 mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR IN SETTING DMX_FILTER %i for fd %d: ERRNO: %d", pid, fd, errno); | 197 mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR IN SETTING DMX_FILTER %i for fd %d: ERRNO: %d", pid, fd, errno); |
158 return 0; | 198 return 0; |
159 } | 199 } |