|
From: <ni...@us...> - 2007-03-19 00:40:46
|
Update of /cvsroot/dvbtools/dvbstream In directory sc8-pr-cvs12.sourceforge.net:/tmp/cvs-serv25654 Modified Files: dvbstream.c Log Message: added a pidmap to the map structure, that is set according to the pids chosen and used in the core pid-selection code Index: dvbstream.c =================================================================== RCS file: /cvsroot/dvbtools/dvbstream/dvbstream.c,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** dvbstream.c 17 Mar 2007 11:08:07 -0000 1.47 --- dvbstream.c 17 Mar 2007 12:41:13 -0000 1.48 *************** *** 408,411 **** --- 408,412 ---- int num; int pid_cnt; + PID_BIT_MAP pidmap; long start_time; // in seconds long end_time; // in seconds *************** *** 458,461 **** --- 459,485 ---- #define setbit(buf, pid) buf[(pid)/8] |= (1 << ((pid) % 8)) #define clearbits(buf) memset(buf, 0, sizeof(PID_BIT_MAP)) + #define setallbits(buf) memset(buf, 0xFF, sizeof(PID_BIT_MAP)) + + void update_bitmaps() + { + int i, j; + + for(i = 0; i < map_cnt; i++) + { + clearbits(pids_map[i].pidmap); + setbit(pids_map[i].pidmap, 0); + for(j = 0; j < MAX_CHANNELS; j++) + { + if(pids_map[i].pids[j] == -1) break; + if(pids_map[i].pids[j] == 8192) + { + setallbits(pids_map[i].pidmap); + break; + } + setbit(pids_map[i].pidmap, pids_map[i].pids[j]); + //fprintf(stderr, "MAP: %d, PID: %d\n", i, pids_map[i].pids[j]); + } + } + } *************** *** 1079,1082 **** --- 1103,1107 ---- } } + update_bitmaps(); if (signal(SIGHUP, SignalHandler) == SIG_IGN) signal(SIGHUP, SIG_IGN); *************** *** 1243,1248 **** if ( ((pids_map[i].start_time==-1) || (pids_map[i].start_time <= now)) && ((pids_map[i].end_time==-1) || (pids_map[i].end_time >= now))) { ! for (j = 0; j < MAX_CHANNELS; j++) { ! if (pids_map[i].pids[j] == 8192 || pids_map[i].pids[j] == pid) { errno = 0; if(pids_map[i].filename) --- 1268,1272 ---- if ( ((pids_map[i].start_time==-1) || (pids_map[i].start_time <= now)) && ((pids_map[i].end_time==-1) || (pids_map[i].end_time >= now))) { ! if(getbit(pids_map[i].pidmap, pid)) { errno = 0; if(pids_map[i].filename) *************** *** 1258,1263 **** pids_map[i].pos += bytes_read; } - break; - } } } --- 1282,1285 ---- |