mirror of
https://github.com/mpv-player/mpv
synced 2025-02-17 13:17:13 +00:00
dvd chapter detect function from Gregory Kovriga
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7855 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
b097b07675
commit
8a61cd287b
@ -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;
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user