|
From: <ni...@us...> - 2007-03-20 23:10:48
|
Update of /cvsroot/dvbtools/dvbstream In directory sc8-pr-cvs12.sourceforge.net:/tmp/cvs-serv20525 Modified Files: dvbstream.c Log Message: added -prog and -pid to select between pid and program mode; in program mode the whole TS is opened and all the pids part the program(s) will be saved to the output map Index: dvbstream.c =================================================================== RCS file: /cvsroot/dvbtools/dvbstream/dvbstream.c,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** dvbstream.c 17 Mar 2007 23:02:30 -0000 1.52 --- dvbstream.c 20 Mar 2007 23:10:43 -0000 1.53 *************** *** 99,102 **** --- 99,107 ---- int streamtype = RTP; + #define PID_MODE 0 + #define PROG_MODE 1 + static int selection_mode = PID_MODE; + + int open_fe(int* fd_frontend) { if((*fd_frontend = open(frontenddev[card],O_RDWR | O_NONBLOCK)) < 0){ *************** *** 409,412 **** --- 414,419 ---- int num; int pid_cnt; + int progs[MAX_CHANNELS]; + int progs_cnt; PID_BIT_MAP pidmap; long start_time; // in seconds *************** *** 497,500 **** --- 504,529 ---- } } + + + for(j = 0; j < map_cnt; j++) + { + for(k = 0; k < pids_map[j].progs_cnt; k++) + { + for(i = 0; i < PAT.entries_cnt; i++) + { + if(pids_map[j].progs[k] == PAT.entries[i].program) + { + setbit(pids_map[j].pidmap, PAT.entries[i].pmt_pid); + for(n = 0; n < PMT.entries[i].pids_cnt; n++) + { + int pid = PMT.entries[i].pids[n]; + + setbit(pids_map[j].pidmap, pid); + //fprintf(stderr, "\nADDED to map %d PROG pid %d, prog: %d", j, pid, PAT.entries[i].program); + } + } + } + } + } } *************** *** 714,717 **** --- 743,747 ---- struct timeval tv; int found; + int stream_whole_TS=0; /* Output: {uni,multi,broad}cast socket */ *************** *** 851,854 **** --- 881,885 ---- map_cnt++; pids_map[map_cnt-1].pid_cnt = 0; + pids_map[map_cnt-1].progs_cnt = 0; pids_map[map_cnt-1].start_time=start_time; pids_map[map_cnt-1].end_time=end_time; *************** *** 919,922 **** --- 950,959 ---- specInv = INVERSION_AUTO; } + else if(strcmp(argv[i],"-prog")==0) { + selection_mode = PROG_MODE; + } + else if(strcmp(argv[i],"-pid")==0) { + selection_mode = PID_MODE; + } else if (strcmp(argv[i],"-o")==0) { to_stdout = 1; *************** *** 1092,1095 **** --- 1129,1133 ---- // If we are currently processing a "-o:" option: if (map_cnt) { + if(selection_mode == PID_MODE) { // block for the map found = 0; *************** *** 1109,1114 **** --- 1147,1165 ---- pids_map[map_cnt-1].pid_cnt++; } + } + else { + // block for the map + stream_whole_TS=1; + setallbits(USER_PIDS); + found = 0; + for (j=0;j<MAX_CHANNELS;j++) { + if(pids_map[map_cnt-1].progs[j] == pid) found = 1; + } + if(found == 0) + pids_map[map_cnt-1].progs[pids_map[map_cnt-1].progs_cnt++] = pid; + } } + if(selection_mode == PID_MODE) { // block for the list of pids to demux found = 0; *************** *** 1132,1135 **** --- 1183,1187 ---- } } + } } } *************** *** 1185,1188 **** --- 1237,1245 ---- fprintf(stderr,"dvbstream will stop after %d seconds (%d minutes)\n",secs,secs/60); + if(stream_whole_TS) { + npids=1; + pids[0] = 8192; + } + else for(i=0; i<npids; i++) { if(pids[i] == 8192) { |