[Mplayer-cvslog] CVS: main/libmpdemux open.c,1.61,1.62 stream.h,1.52,1.53

Zoltan Ponekker pontscho at mplayerhq.hu
Wed Oct 23 00:45:33 CEST 2002


Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var/tmp.root/cvs-serv28191/libmpdemux

Modified Files:
	open.c stream.h 
Log Message:
dvd chapter detect function from Gregory Kovriga

Index: open.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/open.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -r1.61 -r1.62
--- open.c	6 Oct 2002 18:03:12 -0000	1.61
+++ open.c	22 Oct 2002 22:45:30 -0000	1.62
@@ -564,6 +564,34 @@
 }
 
 #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;

Index: stream.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/stream.h,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- stream.h	6 Oct 2002 18:03:12 -0000	1.52
+++ stream.h	22 Oct 2002 22:45:30 -0000	1.53
@@ -258,6 +258,7 @@
 
 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
 							    




More information about the MPlayer-cvslog mailing list