예제 #1
0
int main(int argc, char *argv[])
{
  dvd_reader_t *dvd;
  program_name = argv[0];
  
  if(argc != 3) {
    usage();
    return 1;
  }

  dvd = DVDOpen( argv[ 1 ] );
  if( !dvd ) {
    fprintf( stderr, "Can't open disc %s!\n", argv[ 1 ] );
    return -1;
  }

  ifo_print( dvd, atoi( argv[ 2 ] ) );
  DVDClose(dvd);

  DVDFinish(); //to keep memory checkers from complaining 
  return 0;  
}
예제 #2
0
파일: title_info.c 프로젝트: jjg/mdvd
int main( int argc, char **argv )
{
    dvd_reader_t *dvd;
    ifo_handle_t *ifo_file;
    tt_srpt_t *tt_srpt;
    int i, j;

    /**
     * Usage.
     */
    if( argc != 2 ) {
        fprintf( stderr, "Usage: %s <dvd path>\n", argv[ 0 ] );
        return -1;
    }

    dvd = DVDOpen( argv[ 1 ] );
    if( !dvd ) {
        fprintf( stderr, "Couldn't open DVD: %s\n", argv[ 1 ] );
        return -1;
    }

    ifo_file = ifoOpen( dvd, 0 );
    if( !ifo_file ) {
        fprintf( stderr, "Can't open VMG info.\n" );
        DVDClose( dvd );
        return -1;
    }
    tt_srpt = ifo_file->tt_srpt;

    //printf( "There are %d titles.\n", tt_srpt->nr_of_srpts );
	
	// let's see if we can make this spit out JSON...
	printf("[\n");

    for( i = 0; i < tt_srpt->nr_of_srpts; ++i ) {
        ifo_handle_t *vts_file;
        vts_ptt_srpt_t *vts_ptt_srpt;
        pgc_t *cur_pgc;
        int vtsnum, ttnnum, pgcnum, chapts;
	
        vtsnum = tt_srpt->title[ i ].title_set_nr;
        ttnnum = tt_srpt->title[ i ].vts_ttn;
        chapts = tt_srpt->title[ i ].nr_of_ptts;

		printf("{\"title\":\"%d\",\n", i + 1);
		printf("\"vts\":\"%d\",\n", vtsnum);
		printf("\"ttn\":\"%d\",\n", ttnnum);
		printf("\"chapters\":[\n");
	
        //printf( "\nTitle %d:\n", i + 1 );
        //printf( "\tIn VTS: %d [TTN %d]\n", vtsnum, ttnnum );
        //printf( "\n" );
        //printf( "\tTitle has %d chapters and %d angles\n", chapts,
        //        tt_srpt->title[ i ].nr_of_angles );

        vts_file = ifoOpen( dvd, vtsnum );
        if( !vts_file ) {
            fprintf( stderr, "Can't open info file for title %d.\n", vtsnum );
            DVDClose( dvd );
            return -1;
        }

        vts_ptt_srpt = vts_file->vts_ptt_srpt;
        for( j = 0; j < chapts; ++j ) {
            int start_cell;
            int pgn;

            pgcnum = vts_ptt_srpt->title[ ttnnum - 1 ].ptt[ j ].pgcn;
            pgn = vts_ptt_srpt->title[ ttnnum - 1 ].ptt[ j ].pgn;
            cur_pgc = vts_file->vts_pgcit->pgci_srp[ pgcnum - 1 ].pgc;
            start_cell = cur_pgc->program_map[ pgn - 1 ] - 1;

			printf("{\"chapter\":\"%d\"}", j + 1);

			if(j < chapts - 1){
				printf(",");
			}
 
			printf("\n");
			

			/*	
            printf( "\tChapter %3d [PGC %2d, PG %2d] starts at Cell %2d [sector %x-%x]\n",
                    j, pgcnum, pgn, start_cell,
                    cur_pgc->cell_playback[ start_cell ].first_sector,
                    cur_pgc->cell_playback[ start_cell ].last_sector );
			*/
        }

		printf("]}");

		if(i < tt_srpt->nr_of_srpts - 1){
			printf(",");
		}

		printf("\n");

        ifoClose( vts_file );
    }

	printf("]");

    ifoClose( ifo_file );
    DVDClose( dvd );
    DVDFinish();
    return 0;
}