comparison stream/stream_dvb.c @ 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 64a2ae04a33a
children 8d486fd6cf2f
comparison
equal deleted inserted replaced
21813:85f8a5ce6e91 21814:8032b9d9349d
131 dvb_channels_list *list; 131 dvb_channels_list *list;
132 FILE *f; 132 FILE *f;
133 char line[CHANNEL_LINE_LEN], *colon; 133 char line[CHANNEL_LINE_LEN], *colon;
134 134
135 int fields, cnt, pcnt, k; 135 int fields, cnt, pcnt, k;
136 int has8192; 136 int has8192, has0;
137 dvb_channel_t *ptr, *tmp, chn; 137 dvb_channel_t *ptr, *tmp, chn;
138 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]; 138 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];
139 const char *cbl_conf = "%d:%255[^:]:%d:%255[^:]:%255[^:]:%255[^:]:%255[^:]\n"; 139 const char *cbl_conf = "%d:%255[^:]:%d:%255[^:]:%255[^:]:%255[^:]:%255[^:]\n";
140 const char *sat_conf = "%d:%c:%d:%d:%255[^:]:%255[^:]\n"; 140 const char *sat_conf = "%d:%c:%d:%d:%255[^:]:%255[^:]\n";
141 const char *ter_conf = "%d:%255[^:]:%255[^:]:%255[^:]:%255[^:]:%255[^:]:%255[^:]:%255[^:]:%255[^:]:%255[^:]:%255[^:]\n"; 141 const char *ter_conf = "%d:%255[^:]:%255[^:]:%255[^:]:%255[^:]:%255[^:]:%255[^:]:%255[^:]:%255[^:]:%255[^:]:%255[^:]\n";
256 } 256 }
257 257
258 if((fields < 2) || (ptr->pids_cnt <= 0) || (ptr->freq == 0) || (strlen(ptr->name) == 0)) 258 if((fields < 2) || (ptr->pids_cnt <= 0) || (ptr->freq == 0) || (strlen(ptr->name) == 0))
259 continue; 259 continue;
260 260
261 has8192 = 0; 261 has8192 = has0 = 0;
262 for(cnt = 0; cnt < ptr->pids_cnt; cnt++) 262 for(cnt = 0; cnt < ptr->pids_cnt; cnt++)
263 { 263 {
264 if(ptr->pids[cnt] == 8192) 264 if(ptr->pids[cnt] == 8192)
265 {
266 has8192 = 1; 265 has8192 = 1;
267 break; 266 if(ptr->pids[cnt] == 0)
268 } 267 has0 = 1;
269 } 268 }
270 if(has8192) 269 if(has8192)
271 { 270 {
272 ptr->pids[0] = 8192; 271 ptr->pids[0] = 8192;
273 ptr->pids_cnt = 1; 272 ptr->pids_cnt = 1;
274 } 273 }
275 else 274 else if(! has0)
276 { 275 {
277 ptr->pids[ptr->pids_cnt] = 0; //PID 0 is the PAT 276 ptr->pids[ptr->pids_cnt] = 0; //PID 0 is the PAT
278 ptr->pids_cnt++; 277 ptr->pids_cnt++;
279 } 278 }
280 mp_msg(MSGT_DEMUX, MSGL_V, " PIDS: "); 279 mp_msg(MSGT_DEMUX, MSGL_V, " PIDS: ");