*** MPlayer-20021022/mplayer.c Sat Oct 19 22:26:02 2002 --- MPlayer-new/mplayer.c Tue Oct 22 18:44:38 2002 *************** *** 278,283 **** --- 278,316 ---- #define INITED_VCODEC 2048 #define INITED_ALL 0xFFFF + #ifdef USE_GUI + #ifdef USE_DVDREAD + static int dvd_chapter_from_cell(dvd_priv_t* dvd,int title,int cell) + { + pgc_t * cur_pgc; + ptt_info_t* ptt; + int chapter = cell; + int pgc_id,pgn; + if(title < 0 || cell < 0){ + return 0; + } + /* for most DVD's chapter == cell */ + /* but there are more complecated cases... */ + if(chapter >= dvd->vmg_file->tt_srpt->title[title].nr_of_ptts){ + chapter = dvd->vmg_file->tt_srpt->title[title].nr_of_ptts-1; + } + title = dvd->tt_srpt->title[title].vts_ttn-1; + ptt = dvd->vts_file->vts_ptt_srpt->title[title].ptt; + while(chapter >= 0){ + pgc_id = ptt[chapter].pgcn; + pgn = ptt[chapter].pgn; + cur_pgc = dvd->vts_file->vts_pgcit->pgci_srp[pgc_id-1].pgc; + if(cell >= cur_pgc->program_map[pgn-1]-1){ + return chapter; + } + --chapter; + } + /* didn't find a chapter ??? */ + return chapter; + } + #endif + #endif + static void uninit_player(unsigned int mask){ mask=inited_flags&mask; *************** *** 2565,2571 **** if ( stream->type == STREAMTYPE_DVD ) { dvd_priv_t * dvdp = stream->priv; ! guiIntfStruct.DVD.current_chapter=dvdp->cur_cell + 1; } #endif } --- 2598,2607 ---- if ( stream->type == STREAMTYPE_DVD ) { dvd_priv_t * dvdp = stream->priv; ! /*guiIntfStruct.DVD.current_chapter=dvdp->cur_cell + 1;*/ ! guiIntfStruct.DVD.current_chapter= ! dvd_chapter_from_cell(dvdp,guiIntfStruct.DVD.current_title-1, ! dvdp->cur_cell)+1; } #endif }