changeset 21814:8032b9d9349d

don't add pid 0 if it's already present in the list
author nicodvb
date Sat, 06 Jan 2007 11:09:27 +0000
parents 85f8a5ce6e91
children 8b2d611f3ade
files stream/stream_dvb.c
diffstat 1 files changed, 5 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/stream/stream_dvb.c	Sat Jan 06 10:07:45 2007 +0000
+++ b/stream/stream_dvb.c	Sat Jan 06 11:09:27 2007 +0000
@@ -133,7 +133,7 @@
 	char line[CHANNEL_LINE_LEN], *colon;
 
 	int fields, cnt, pcnt, k;
-	int has8192;
+	int has8192, has0;
 	dvb_channel_t *ptr, *tmp, chn;
 	char tmp_lcr[256], tmp_hier[256], inv[256], bw[256], cr[256], mod[256], transm[256], gi[256], vpid_str[256], apid_str[256];
 	const char *cbl_conf = "%d:%255[^:]:%d:%255[^:]:%255[^:]:%255[^:]:%255[^:]\n";
@@ -258,21 +258,20 @@
 		if((fields < 2) || (ptr->pids_cnt <= 0) || (ptr->freq == 0) || (strlen(ptr->name) == 0))
 			continue;
 
-		has8192 = 0;
+		has8192 = has0 = 0;
 		for(cnt = 0; cnt < ptr->pids_cnt; cnt++)
 		{
 			if(ptr->pids[cnt] == 8192)
-			{
 				has8192 = 1;
-				break;
-			}
+			if(ptr->pids[cnt] == 0)
+				has0 = 1;
 		}
 		if(has8192)
 		{
 			ptr->pids[0] = 8192;
 			ptr->pids_cnt = 1;
 		}
-		else
+		else if(! has0)
 		{
 			ptr->pids[ptr->pids_cnt] = 0;	//PID 0 is the PAT
 			ptr->pids_cnt++;