diff mencoder.c @ 25955:eff9e1b25743

-chapter is now handled uniformly calling demuxer_seek_chapter() instead of letting individual demuxers and stream readers do their nasty job
author nicodvb
date Mon, 11 Feb 2008 22:03:34 +0000
parents afaf3ec733d3
children afa125da85cf
line wrap: on
line diff
--- a/mencoder.c	Mon Feb 11 21:24:21 2008 +0000
+++ b/mencoder.c	Mon Feb 11 22:03:34 2008 +0000
@@ -603,6 +603,11 @@
     mp_msg(MSGT_DEMUXER, MSGL_FATAL, MSGTR_CannotOpenDemuxer);
 	mencoder_exit(1,NULL);
   }
+ 
+  if(dvd_chapter>1) {
+    float pts;
+    demuxer_seek_chapter(demuxer, dvd_chapter-1, 1, &pts, NULL, NULL);
+  }
 
 d_audio=demuxer2 ? demuxer2->audio : demuxer->audio;
 d_video=demuxer->video;
@@ -1098,6 +1103,11 @@
       --play_n_frames;
       if(play_n_frames<0) break;
     }
+    if(dvd_last_chapter>0) {
+      int cur_chapter = demuxer_get_current_chapter(demuxer);
+      if(cur_chapter!=-1 && cur_chapter+1>dvd_last_chapter)
+        break;
+    }
 
 goto_redo_edl:
     if (next_edl_record && sh_video && sh_video->pts >= next_edl_record->start_sec) {