summaryrefslogtreecommitdiffstats
path: root/libmpdemux
diff options
context:
space:
mode:
authorpontscho <pontscho@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-10-22 22:45:30 +0000
committerpontscho <pontscho@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-10-22 22:45:30 +0000
commit8a61cd287be192dcf6f4b944b07bd30ae69000f6 (patch)
treea5f76ca3634211bca326b474066a4925658c9ca1 /libmpdemux
parentb097b0767531e15753c44af6f9b90cb0bb5eef66 (diff)
downloadmpv-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
Diffstat (limited to 'libmpdemux')
-rw-r--r--libmpdemux/open.c28
-rw-r--r--libmpdemux/stream.h1
2 files changed, 29 insertions, 0 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