Update of /cvsroot/dvbtools/dvbstream
In directory sc8-pr-cvs12.sourceforge.net:/tmp/cvs-serv14363
Modified Files:
dvbstream.c
Log Message:
selection of programs by name (by the SDT; it won't work in ATSC streams)
Index: dvbstream.c
===================================================================
RCS file: /cvsroot/dvbtools/dvbstream/dvbstream.c,v
retrieving revision 1.57
retrieving revision 1.58
diff -C2 -d -r1.57 -r1.58
*** dvbstream.c 24 Mar 2007 22:46:49 -0000 1.57
--- dvbstream.c 25 Mar 2007 21:05:07 -0000 1.58
***************
*** 416,419 ****
--- 416,421 ----
int progs[MAX_CHANNELS];
int progs_cnt;
+ uint8_t **prognames;
+ int prognames_cnt;
PID_BIT_MAP pidmap;
long start_time; // in seconds
***************
*** 536,539 ****
--- 538,564 ----
}
}
+
+
+ for(i = 0; i < map_cnt; i++)
+ {
+ for(j = 0; j < pids_map[i].prognames_cnt; j++)
+ {
+ for(k = 0; k < PMT.cnt; k++)
+ {
+ if(!strcmp(pids_map[i].prognames[j], PMT.entries[k].name))
+ {
+ setbit(pids_map[i].pidmap, PAT.entries[k].pmt_pid);
+ setbit(pids_map[i].pidmap, SDT_PID);
+ for(n = 0; n < PMT.entries[k].pids_cnt; n++)
+ {
+ int pid = PMT.entries[k].pids[n];
+
+ setbit(pids_map[i].pidmap, pid);
+ //fprintf(stderr, "\nADDED to map %d PROG pid %d, prog: %d", j, pid, PAT.entries[k].program);
+ }
+ }
+ }
+ }
+ }
}
***************
*** 733,737 ****
--- 758,764 ----
for(k = 0; k < PAT.entries_cnt, k < PMT.cnt; k++)
if(PAT.entries[k].program == prog)
+ {
found = k;
+
if(k != -1)
***************
*** 767,770 ****
--- 794,798 ----
}
}
+ }
i += 5 + descr_len;
}
***************
*** 795,799 ****
}
else if(pid == SDT_PID)
! parse_sdt(pusi, &buf[l], TS_SIZE - l);
else
{
--- 823,838 ----
}
else if(pid == SDT_PID)
! {
! if(parse_sdt(pusi, &buf[l], TS_SIZE - l) == 2)
! {
! int i;
! for(i = 0; i < PMT.cnt; i++)
! {
! PMT.entries[i].section.pos = SECTION_LEN+1;
! PMT.entries[i].version = -1;
! }
! update_bitmaps();
! }
! }
else
{
***************
*** 811,814 ****
--- 850,866 ----
}
+ static int is_string(char *s)
+ {
+ int i, n, len;
+
+ n = 0;
+ len = strlen(s);
+ for(i = 0; i < len; i++)
+ if(isdigit(s[i]))
+ n++;
+
+ return (n != len);
+ }
+
int main(int argc, char **argv)
{
***************
*** 1251,1257 ****
--- 1303,1324 ----
else {
// block for the map
+ int is_progname = is_string(argv[i]);
+ pids_map_t *map = &(pids_map[map_cnt-1]);
stream_whole_TS=1;
setallbits(USER_PIDS);
found = 0;
+ if(is_progname) {
+ for(j=0;j<map->prognames_cnt;j++) {
+ if(!strcmp(map->prognames[j], argv[i]))
+ found = 1;
+ }
+ if(found == 0) {
+ map->prognames = realloc(map->prognames, (map->prognames_cnt+1)*sizeof(map->prognames));
+ map->prognames_cnt++;
+ map->prognames[map->prognames_cnt-1] = malloc(strlen(argv[i])+1);
+ strcpy(map->prognames[map->prognames_cnt-1], argv[i]);
+ }
+ }
+ else {
for (j=0;j<MAX_CHANNELS;j++) {
if(pids_map[map_cnt-1].progs[j] == pid) found = 1;
***************
*** 1261,1264 ****
--- 1328,1332 ----
}
}
+ }
if(selection_mode == PID_MODE) {
|