changeset 21241:6e3fb3e851ac

match exactly card number N specified, rather than the N-th actually usable
author nicodvb
date Sun, 26 Nov 2006 12:03:23 +0000
parents 914a7d3df7ac
children 8d671a2c1b00
files stream/stream_dvb.c
diffstat 1 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/stream/stream_dvb.c	Sun Nov 26 11:56:54 2006 +0000
+++ b/stream/stream_dvb.c	Sun Nov 26 12:03:23 2006 +0000
@@ -666,7 +666,7 @@
 	struct stream_priv_s* p = (struct stream_priv_s*)opts;
 	dvb_priv_t *priv;
 	char *progname;
-	int tuner_type = 0;
+	int tuner_type = 0, i;
 
 
 	if(mode != STREAM_READ)
@@ -688,13 +688,22 @@
 	dvb_config->priv = priv;
 	priv->config = dvb_config;
 
-	if(p->card < 1 || p->card > priv->config->count)
+	priv->card = -1;
+	for(i=0; i<priv->config->count; i++)
+	{
+		if(priv->config->cards[i].devno+1 == p->card)
+		{
+			priv->card = i;
+			break;
+		}
+	}
+
+	if(priv->card == -1)
  	{
 		free(priv);
 		mp_msg(MSGT_DEMUX, MSGL_ERR, "NO CONFIGURATION FOUND FOR CARD N. %d, exit\n", p->card);
  		return STREAM_ERROR;
  	}
-	priv->card = p->card - 1;
 	priv->timeout = p->timeout;
 	
 	tuner_type = priv->config->cards[priv->card].type;