[Mplayer-cvslog] CVS: main/libmpdemux dvb_tune.c,1.7,1.8
Nico Sabbi CVS
syncmail at mplayerhq.hu
Mon Jul 12 22:52:04 CEST 2004
CVS change done by Nico Sabbi CVS
Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var2/tmp/cvs-serv10051
Modified Files:
dvb_tune.c
Log Message:
added multi-pid parsing code (up to 15), pid 0 is always added (for the PAT)
Index: dvb_tune.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/dvb_tune.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- dvb_tune.c 26 Apr 2004 21:18:07 -0000 1.7
+++ dvb_tune.c 12 Jul 2004 20:52:02 -0000 1.8
@@ -90,8 +90,12 @@
}
-int dvb_open_devices(dvb_priv_t *priv, int n)
+int dvb_set_ts_filt(int fd, uint16_t pid, dmx_pes_type_t pestype);
+
+int dvb_open_devices(dvb_priv_t *priv, int n, int demux_cnt, int *pids)
{
+ int i;
+
priv->fe_fd = open(dvb_frontenddev[n], O_RDWR | O_NONBLOCK);
if(priv->fe_fd < 0)
{
@@ -109,18 +113,21 @@
return 0;
}
#endif
- priv->demux_fd[0] = open(dvb_demuxdev[n], O_RDWR);
- if(priv->demux_fd[0] < 0)
- {
- mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR OPENING DEMUX 0: %d\n", errno);
- return 0;
- }
-
- priv->demux_fd[1] = open(dvb_demuxdev[n], O_RDWR);
- if(priv->demux_fd[1] < 0)
+ priv->demux_fds_cnt = 0;
+ mp_msg(MSGT_DEMUX, MSGL_V, "DVB_OPEN_DEVICES(%d)\n", demux_cnt);
+ for(i = 0; i < demux_cnt; i++)
{
- mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR OPENING DEMUX 1: %d\n", errno);
- return 0;
+ priv->demux_fds[i] = open(dvb_demuxdev[n], O_RDWR | O_NONBLOCK);
+ if(priv->demux_fds[i] < 0)
+ {
+ mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR OPENING DEMUX 0: %d\n", errno);
+ return 0;
+ }
+ else
+ {
+ 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);
+ priv->demux_fds_cnt++;
+ }
}
@@ -135,6 +142,38 @@
}
+int dvb_fix_demuxes(dvb_priv_t *priv, int cnt, int *pids)
+{
+ int i;
+
+ mp_msg(MSGT_DEMUX, MSGL_V, "FIX %d -> %d\n", priv->demux_fds_cnt, cnt);
+ if(priv->demux_fds_cnt >= cnt)
+ {
+ for(i = priv->demux_fds_cnt-1; i >= cnt; i--)
+ {
+ mp_msg(MSGT_DEMUX, MSGL_V, "FIX, CLOSE fd(%d): %d\n", i, priv->demux_fds[i]);
+ close(priv->demux_fds[i]);
+ }
+ priv->demux_fds_cnt = cnt;
+ }
+ else if(priv->demux_fds_cnt < cnt)
+ {
+ for(i = priv->demux_fds_cnt; i < cnt; i++)
+ {
+ priv->demux_fds[i] = open(dvb_demuxdev[priv->card], O_RDWR | O_NONBLOCK);
+ mp_msg(MSGT_DEMUX, MSGL_V, "FIX, OPEN fd(%d): %d\n", i, priv->demux_fds[i]);
+ if(priv->demux_fds[i] < 0)
+ {
+ mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR OPENING DEMUX 0: %d\n", errno);
+ return 0;
+ }
+ else
+ priv->demux_fds_cnt++;
+ }
+ }
+
+ return 1;
+}
int dvb_set_ts_filt(int fd, uint16_t pid, dmx_pes_type_t pestype)
{
@@ -152,6 +191,7 @@
pesFilterParams.flags = DMX_IMMEDIATE_START;
+ errno = 0;
if ((i = ioctl(fd, DMX_SET_PES_FILTER, &pesFilterParams)) < 0)
{
mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR IN SETTING DMX_FILTER %i for fd %d: ERRNO: %d", pid, fd, errno);
More information about the MPlayer-cvslog
mailing list