diff options
author | pontscho <pontscho@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-10-22 22:45:30 +0000 |
---|---|---|
committer | pontscho <pontscho@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-10-22 22:45:30 +0000 |
commit | 8a61cd287be192dcf6f4b944b07bd30ae69000f6 (patch) | |
tree | a5f76ca3634211bca326b474066a4925658c9ca1 | |
parent | b097b0767531e15753c44af6f9b90cb0bb5eef66 (diff) | |
download | mpv-8a61cd287be192dcf6f4b944b07bd30ae69000f6.tar.bz2 mpv-8a61cd287be192dcf6f4b944b07bd30ae69000f6.tar.xz |
dvd chapter detect function from Gregory Kovriga
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7855 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | libmpdemux/open.c | 28 | ||||
-rw-r--r-- | libmpdemux/stream.h | 1 | ||||
-rw-r--r-- | mplayer.c | 3 |
3 files changed, 31 insertions, 1 deletions
diff --git a/libmpdemux/open.c b/libmpdemux/open.c index 5b866e2dee..0e1f9523d7 100644 --- a/libmpdemux/open.c +++ b/libmpdemux/open.c @@ -564,6 +564,34 @@ int dvd_parse_chapter_range(struct config *conf, const char *range){ } #ifdef USE_DVDREAD +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; +} int dvd_aid_from_lang(stream_t *stream, unsigned char* lang){ dvd_priv_t *d=stream->priv; diff --git a/libmpdemux/stream.h b/libmpdemux/stream.h index 66fe7ef5e8..b051df2875 100644 --- a/libmpdemux/stream.h +++ b/libmpdemux/stream.h @@ -258,6 +258,7 @@ typedef struct { int dvd_aid_from_lang(stream_t *stream, unsigned char* lang); int dvd_sid_from_lang(stream_t *stream, unsigned char* lang); +int dvd_chapter_from_cell(dvd_priv_t *dvd,int title,int cell); #endif @@ -2565,7 +2565,8 @@ if(rel_seek_secs || abs_seek_pos){ if ( stream->type == STREAMTYPE_DVD ) { dvd_priv_t * dvdp = stream->priv; - guiIntfStruct.DVD.current_chapter=dvdp->cur_cell + 1; + /*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 } |