|
From: <ni...@us...> - 2007-09-12 21:48:39
|
Update of /cvsroot/dvbtools/dvbstream In directory sc8-pr-cvs12.sourceforge.net:/tmp/cvs-serv27930 Modified Files: dvbstream.c Log Message: added code to demux programs/pids from stdin rather than from a dvb card Index: dvbstream.c =================================================================== RCS file: /cvsroot/dvbtools/dvbstream/dvbstream.c,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** dvbstream.c 25 Mar 2007 21:05:07 -0000 1.58 --- dvbstream.c 12 Sep 2007 21:48:34 -0000 1.59 *************** *** 98,101 **** --- 98,102 ---- char pol=0; int streamtype = RTP; + static int use_stdin=0; #define PID_MODE 0 *************** *** 321,324 **** --- 322,326 ---- srate=atoi(&cmd[i])*1000UL; fprintf(stderr,"Tuning to %ld,%ld,%c\n",freq,srate,pol); + if(!use_stdin) tune_it(fd_frontend,freq,srate,pol,tone,specInv,diseqc,modulation,HP_CodeRate,TransmissionMode,guardInterval,bandWidth, LP_CodeRate, hier); } *************** *** 990,993 **** --- 992,997 ---- output_type=RTP_NONE; if (secs==-1) { secs=10; } + } else if(strcmp(argv[i],"-stdin")==0) { + use_stdin = 1; } else if (strcmp(argv[i],"-i")==0) { if(pids_map != NULL) { *************** *** 1383,1387 **** alarm(ALARM_TIME); ! if (freq!=0) { if (open_fe(&fd_frontend)) { fprintf(stderr,"Tuning to %ld Hz\n",freq); --- 1387,1391 ---- alarm(ALARM_TIME); ! if (freq!=0 && !use_stdin) { if (open_fe(&fd_frontend)) { fprintf(stderr,"Tuning to %ld Hz\n",freq); *************** *** 1417,1420 **** --- 1421,1427 ---- } } + if(use_stdin) { + fd_dvr = fileno(stdin); + } else { for (i=0;i<npids;i++) { if((fd[i] = open(demuxdev[card],O_RDWR|O_NONBLOCK)) < 0){ *************** *** 1435,1438 **** --- 1442,1446 ---- setbit(USER_PIDS, pids[i]); } + } gettimeofday(&tv,(struct timezone*) NULL); *************** *** 1541,1545 **** if (read(fd_dvr,buf,TS_SIZE) > 0) { my_ts_to_ps((uint8_t*)buf, pids[0], pids[1]); ! } } else if(output_type==MAP_TS) { int bytes_read; --- 1549,1553 ---- if (read(fd_dvr,buf,TS_SIZE) > 0) { my_ts_to_ps((uint8_t*)buf, pids[0], pids[1]); ! } else if(use_stdin) break; } else if(output_type==MAP_TS) { int bytes_read; *************** *** 1577,1580 **** --- 1585,1589 ---- } } + else if(use_stdin) break; } else { if (do_analyse) { *************** *** 1596,1602 **** --- 1605,1613 ---- if (!to_stdout && !map_cnt) close(socketOut); + if(!use_stdin) { for (i=0;i<npids;i++) close(fd[i]); close(fd_dvr); close(fd_frontend); + } if (do_analyse) { |