Changeset 10808
- Timestamp:
- 10/29/11 20:48:34 (11 years ago)
- Location:
- titan/titan
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
titan/titan/epg.h
r10792 r10808 1153 1153 } 1154 1154 #endif 1155 //set timer to akttime1156 if(flag == 0) status.epgtimer = time(NULL);1157 if(flag == 1) status.epgscantimer = time(NULL);1158 1155 1159 1156 epgnode = addepg(tmpchnode, HILO(evt->event_id), eit->version_number, starttime, endtime, NULL, 1); … … 1333 1330 struct dvbdev* dmxnode; 1334 1331 struct eit* eit = NULL; 1332 unsigned long seen[16] = {0}; 1333 unsigned long firstseen[16] = {0}; 1334 int roundend = 0, round = 0x4e, i = 0; 1335 time_t akttime, roundstart; 1335 1336 1336 1337 buf = malloc(MINMALLOC * 4); … … 1359 1360 dmxsetbuffersize(dmxnode, getconfigint("dmxepgbuffersize", NULL)); 1360 1361 dmxsetsource(dmxnode, fenode->fedmxsource); 1361 dmxsetfilter(dmxnode, 0x12, 0, 5);1362 1362 1363 1363 #ifdef SIMULATE … … 1369 1369 } 1370 1370 #endif 1371 if(flag == 0) status.epgtimer = time(NULL); 1372 if(flag == 1) status.epgscantimer = time(NULL); 1371 1372 for(i = 2; i < 16; i++) firstseen[i] = 1; 1373 roundstart = time(NULL); 1374 dmxsetfilter(dmxnode, 0x12, 0, 8); 1373 1375 while(self->aktion != STOP && self->aktion != PAUSE) 1374 1376 { 1377 akttime = time(NULL); 1378 roundend = 1; 1379 1380 //check end of epg infos 1381 for(i = 0; i < 16; i++) 1382 { 1383 if(roundstart + 5 < akttime && firstseen[i] == 0) 1384 firstseen[i] = 1; 1385 if(roundstart + 30 < akttime && firstseen[i] != 1) 1386 firstseen[i] = 1; 1387 if(firstseen[i] != 1) 1388 roundend = 0; 1389 } 1390 1391 if(roundend == 1) 1392 { 1393 for(i = 0; i < 16; i++) 1394 { 1395 seen[i] = 0; 1396 firstseen[i] = 0; 1397 } 1398 1399 roundend = 0; 1400 pos = 0; 1401 head = buf; 1402 1403 if(round == 0x60) 1404 { 1405 dmxstop(dmxnode); 1406 if(flag == 1) goto end; 1407 debug(400, "epg no more new data, wait for next run"); 1408 while(self->aktion != STOP && self->aktion != PAUSE) 1409 { 1410 if(count > 10 * 60 * 20) break; //20 min 1411 count++; 1412 usleep(100000); 1413 } 1414 count = 0; 1415 debug(400, "epg next run start"); 1416 } 1417 if(round == 0x4e) 1418 { 1419 dmxsetfilter(dmxnode, 0x12, 0, 6); 1420 round = 0x50; 1421 } 1422 else if(round == 0x50) 1423 { 1424 dmxsetfilter(dmxnode, 0x12, 0, 7); 1425 round = 0x60; 1426 } 1427 else if(round == 0x60) 1428 { 1429 dmxsetfilter(dmxnode, 0x12, 0, 8); 1430 for(i = 2; i < 16; i++) firstseen[i] = 1; 1431 round = 0x4e; 1432 } 1433 roundstart = time(NULL); 1434 continue; 1435 } 1436 1375 1437 if(pos < 3) goto read_more; 1376 1438 … … 1380 1442 if (pos < len) goto read_more; 1381 1443 1382 if(eit->table_id < 0x4e || eit->table_id > 0x6f) 1383 { 1384 err("epg table id"); 1385 pos -= len; 1386 head += len; 1387 goto read_more; 1388 } 1389 1390 if(dvbcrc32((uint8_t *)head, len) == 0) 1391 parseeit(chnode, head, len, flag); 1392 else 1393 { 1394 err("epg crc"); 1444 if(eit->table_id - round < 0 || eit->table_id - round > 15 || dvbcrc32((uint8_t *)head, len) != 0) 1445 { 1446 err("epg crc or table id not ok"); 1395 1447 dmxstop(dmxnode); 1396 1448 dmxstart(dmxnode); … … 1399 1451 goto read_more; 1400 1452 } 1453 1454 seen[eit->table_id - round] = (eit->table_id << 24) | (HILO(eit->service_id) << 8) | eit->section_number; 1455 1456 if(firstseen[eit->table_id - round] == 0) 1457 firstseen[eit->table_id - round] = seen[eit->table_id - round]; 1458 else if(firstseen[eit->table_id - round] == seen[eit->table_id - round]) 1459 firstseen[eit->table_id - round] = 1; 1460 1461 parseeit(chnode, head, len, flag); 1401 1462 1402 1463 //remove packet … … 1431 1492 usleep(1000); 1432 1493 #endif 1433 if(flag == 1 && status.epgscantimer < time(NULL) - 3) goto end;1434 if(flag == 0 && status.epgtimer < time(NULL) - 3)1435 {1436 debug(400, "epg no more new data, wait for next run");1437 dmxstop(dmxnode);1438 pos = 0;1439 head = buf;1440 while(self->aktion != STOP && self->aktion != PAUSE && status.epgtimer < time(NULL) - 3)1441 {1442 if(count > 2 * 60 * 20) break; //20 min1443 count++;1444 usleep(500000);1445 }1446 count = 0;1447 status.epgtimer = time(NULL);1448 dmxstart(dmxnode);1449 debug(400, "epg next run start");1450 }1451 1494 if(readlen < 0) readlen = 0; 1452 1495 head = buf; -
titan/titan/struct.h
r10718 r10808 894 894 // httpd thread pointer 895 895 struct stimerthread* httpthread; 896 // got new epg if 0 and stop it no new epg for a spezified period897 time_t epgtimer;898 // same as epgtimer for epgscan899 time_t epgscantimer;900 896 struct service* aktservice; 901 897 struct service* lastservice;
Note: See TracChangeset
for help on using the changeset viewer.