[Mplayer-cvslog] CVS: main/libmpdemux open.c,1.32,1.33 stream.h,1.26,1.27

Kim Minh Kaplan CVS kmkaplan at mplayer.dev.hu
Mon Jan 21 10:44:37 CET 2002


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

Modified Files:
	open.c stream.h 
Log Message:
Add option -last-chapter for DVD playing/encoding

Index: open.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/open.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- open.c	19 Jan 2002 09:04:02 -0000	1.32
+++ open.c	21 Jan 2002 09:44:25 -0000	1.33
@@ -24,6 +24,7 @@
 
 int dvd_title=0;
 int dvd_chapter=1;
+int dvd_last_chapter=0;
 int dvd_angle=1;
 char* dvd_device=NULL;
 char* cdrom_device=NULL;
@@ -162,7 +163,16 @@
         DVDClose( dvd );
         return NULL;
     }
+    if( dvd_last_chapter>0 ) {
+	if ( dvd_last_chapter<dvd_chapter || dvd_last_chapter>tt_srpt->title[dvd_title].nr_of_ptts ) {
+	    mp_msg(MSGT_OPEN,MSGL_ERR, "Invalid DVD last chapter number: %d\n", dvd_last_chapter);
+	    ifoClose( vmg_file );
+	    DVDClose( dvd );
+	    return NULL;
+	}
+    }
     --dvd_chapter; // remap 1.. -> 0..
+    /* XXX No need to remap dvd_last_chapter */
     /**
      * Make sure the angle number is valid for this title.
      */
@@ -315,6 +325,13 @@
     d->cur_cell = d->cur_pgc->program_map[pgn-1] - 1; // start playback here
     d->packs_left=-1;      // for Navi stuff
     d->angle_seek=0;
+    /* XXX dvd_last_chapter is in the range 1..nr_of_ptts */
+    if ( dvd_last_chapter > 0 && dvd_last_chapter < tt_srpt->title[ttn-1].nr_of_ptts ) {
+	pgn=vts_file->vts_ptt_srpt->title[ttn-1].ptt[dvd_last_chapter].pgn;
+	d->last_cell=d->cur_pgc->program_map[pgn-1] - 1;
+    }
+    else
+	d->last_cell=d->cur_pgc->nr_of_cells;
     
     if( d->cur_pgc->cell_playback[d->cur_cell].block_type 
 	== BLOCK_TYPE_ANGLE_BLOCK ) d->cur_cell+=dvd_angle;
@@ -450,7 +467,7 @@
     
     if( d->cur_pgc->cell_playback[ next_cell ].block_type
                                         == BLOCK_TYPE_ANGLE_BLOCK ) {
-	    while(next_cell<d->cur_pgc->nr_of_cells){
+	    while(next_cell<d->last_cell){
                 if( d->cur_pgc->cell_playback[next_cell].block_mode
                                           == BLOCK_MODE_LAST_CELL ) break;
 		++next_cell;
@@ -459,10 +476,10 @@
     mp_msg(MSGT_DVD,MSGL_V, "dvd_next_cell: next2=0x%X  \n",next_cell);
     
     ++next_cell;
-    if(next_cell>=d->cur_pgc->nr_of_cells) return -1; // EOF
+    if(next_cell>=d->last_cell) return -1; // EOF
     if( d->cur_pgc->cell_playback[next_cell].block_type == BLOCK_TYPE_ANGLE_BLOCK ){
 	next_cell+=dvd_angle;
-	if(next_cell>=d->cur_pgc->nr_of_cells) return -1; // EOF
+	if(next_cell>=d->last_cell) return -1; // EOF
     }
     mp_msg(MSGT_DVD,MSGL_V, "dvd_next_cell: next3=0x%X  \n",next_cell);
     return next_cell;

Index: stream.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/stream.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- stream.h	16 Jan 2002 03:23:03 -0000	1.26
+++ stream.h	21 Jan 2002 09:44:25 -0000	1.27
@@ -182,6 +182,7 @@
 //#ifdef USE_DVDREAD
 extern int dvd_title;
 extern int dvd_chapter;
+extern int dvd_last_chapter;
 extern int dvd_angle;
 //#endif
 
@@ -207,6 +208,7 @@
   pgc_t *cur_pgc;
 //
   int cur_cell;
+  int last_cell;
   int cur_pack;
   int cell_last_pack;
 // Navi:




More information about the MPlayer-cvslog mailing list