5 /* reads a ifo file which must be a dvd, and vaidates the title data */
6 /* reports title/program sets which appear to be usable */
8 int usage(const char *nm)
10 printf("usage: %s <path>\n"
11 " <path> = path to dvd mount point\n", nm);
15 int main(int argc, char **argv)
18 return usage(argv[0]);
26 for( i=1; i<argc; ++i ) {
27 if( !strcmp(argv[i], "-v") ) {
30 else if( !strcmp(argv[i], "-p") ) {
31 if( ++i < argc ) program = atoi(argv[i]);
33 else if( !strcmp(argv[i], "-l") ) {
34 if( ++i < argc ) limit = atoi(argv[i]);
36 else if(argv[i][0] == '-') {
37 fprintf(stderr, "Unrecognized command %s\n", argv[i]);
44 fprintf(stderr, "Unknown argument \"%s\"\n", argv[i]);
49 for( i=1; i<100; ++i ) {
50 char ifo_path[PATH_MAX];
51 strncpy(&ifo_path[0], path, sizeof(ifo_path));
52 int l = strnlen(&ifo_path[0],sizeof(ifo_path));
53 snprintf(&ifo_path[l],sizeof(ifo_path)-l,"/VIDEO_TS/VTS_%02d_0.IFO",i);
54 if( access(&ifo_path[0],R_OK) ) break;
56 zmpeg3_t *src = new zmpeg3_t(&ifo_path[0]);
58 uint32_t bits = src->fs->read_uint32();
59 if( bits == zmpeg3_t::IFO_PREFIX ) {
60 int fd = src->fs->get_fd();
61 zifo_t *ifo = src->ifo_open(fd, 0);
63 fprintf(stderr,"Error opening ifo in %s\n", &ifo_path[0]);
67 zicell_table_t icell_addrs;
68 ifo->icell_addresses(&icell_addrs);
69 int programs = ifo->max_inlv+1;
72 printf("processing: %s, %d programs\n",&ifo_path[0], programs);
74 for( int title=0; title<100; ++title ) {
76 for( int pgm=0; pgm<programs; ++pgm ) {
77 int sectors = 0, pcells = 0;
78 int ret = ifo->chk(title, 0, pgm, 0, &icell_addrs, sectors, pcells, angles);
81 if( pcells < limit ) continue;
82 if( program >= 0 && pgm != program ) continue;
85 printf("%s, Title = %d, pcells=%d, sectors = %d, angles %d, program ids=%d",
86 &ifo_path[0], title+1, pcells, sectors, angles+1, title*100+pgm);
89 printf(", %d",title*100+pgm);
91 if( listed ) printf("\n");
100 printf("cant open %s/VIDEO_TS/VTS_01_0.IFO\n",path);