[MPlayer-cvslog] r25987 - in trunk: libmpdemux/demux_mkv.c mencoder.c mplayer.c stream/stream_dvd.c stream/stream_dvdnav.c

nicodvb subversion at mplayerhq.hu
Mon Feb 11 23:03:34 CET 2008


Author: nicodvb
Date: Mon Feb 11 23:03:34 2008
New Revision: 25987

Log:
-chapter is now handled uniformly calling demuxer_seek_chapter() instead
of letting individual demuxers and stream readers do their nasty job


Modified:
   trunk/libmpdemux/demux_mkv.c
   trunk/mencoder.c
   trunk/mplayer.c
   trunk/stream/stream_dvd.c
   trunk/stream/stream_dvdnav.c

Modified: trunk/libmpdemux/demux_mkv.c
==============================================================================
--- trunk/libmpdemux/demux_mkv.c	(original)
+++ trunk/libmpdemux/demux_mkv.c	Mon Feb 11 23:03:34 2008
@@ -2526,17 +2526,6 @@ demux_mkv_open (demuxer_t *demuxer)
       demuxer->movi_start = s->start_pos;
       demuxer->movi_end = s->end_pos;
       demuxer->seekable = 1;
-      if (demuxer->chapters && dvd_chapter>1 && dvd_chapter<=demuxer->num_chapters)
-        {
-          if (!mkv_d->has_first_tc)
-            {
-              mkv_d->first_tc = 0;
-              mkv_d->has_first_tc = 1;
-            }
-          demux_mkv_seek (demuxer,
-                          demuxer->chapters[dvd_chapter-1].start/1000.0, 0.0,
-                          SEEK_ABSOLUTE);
-        }
     }
 
   return DEMUXER_TYPE_MATROSKA;

Modified: trunk/mencoder.c
==============================================================================
--- trunk/mencoder.c	(original)
+++ trunk/mencoder.c	Mon Feb 11 23:03:34 2008
@@ -603,6 +603,11 @@ if(stream->type==STREAMTYPE_DVDNAV){
     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 @@ while(!at_eof){
       --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) {

Modified: trunk/mplayer.c
==============================================================================
--- trunk/mplayer.c	(original)
+++ trunk/mplayer.c	Mon Feb 11 23:03:34 2008
@@ -3278,6 +3278,11 @@ if (mpctx->demuxer && mpctx->demuxer->ty
 
 if(!mpctx->demuxer) 
   goto goto_next_file;
+if(dvd_chapter>1) {
+  float pts;
+  demuxer_seek_chapter(mpctx->demuxer, dvd_chapter-1, 1, &pts, NULL, NULL);
+}
+
 inited_flags|=INITED_DEMUXER;
 
 if (mpctx->stream->type != STREAMTYPE_DVD && mpctx->stream->type != STREAMTYPE_DVDNAV) {
@@ -3644,6 +3649,13 @@ if (mpctx->stream->type == STREAMTYPE_DV
 
 while(!mpctx->eof){
     float aq_sleep_time=0;
+
+if(dvd_last_chapter>0) {
+  int cur_chapter = demuxer_get_current_chapter(mpctx->demuxer);
+  if(cur_chapter!=-1 && cur_chapter+1>dvd_last_chapter)
+    goto goto_next_file;
+}
+
 if(!mpctx->sh_audio && mpctx->d_audio->sh) {
   mpctx->sh_audio = mpctx->d_audio->sh;
   mpctx->sh_audio->ds = mpctx->d_audio;

Modified: trunk/stream/stream_dvd.c
==============================================================================
--- trunk/stream/stream_dvd.c	(original)
+++ trunk/stream/stream_dvd.c	Mon Feb 11 23:03:34 2008
@@ -883,22 +883,6 @@ static int open_s(stream_t *stream,int m
     mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_DVD_CURRENT_TITLE=%d\n", dvd_title);
     --dvd_title; // remap 1.. -> 0..
     /**
-     * Make sure the chapter number is valid for this title.
-     */
-    mp_msg(MSGT_OPEN,MSGL_STATUS, MSGTR_DVDnumChapters, tt_srpt->title[dvd_title].nr_of_ptts);
-    if(dvd_chapter<1 || dvd_chapter>tt_srpt->title[dvd_title].nr_of_ptts) {
-      mp_msg(MSGT_OPEN,MSGL_ERR, MSGTR_DVDinvalidChapter, dvd_chapter);
-      goto fail;
-    }
-    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, MSGTR_DVDinvalidLastChapter, dvd_last_chapter);
-        goto fail;
-      }
-    }
-    --dvd_chapter; // remap 1.. -> 0..
-    /* XXX No need to remap dvd_last_chapter */
-    /**
      * Make sure the angle number is valid for this title.
      */
     mp_msg(MSGT_OPEN,MSGL_STATUS, MSGTR_DVDnumAngles, tt_srpt->title[dvd_title].nr_of_angles);
@@ -1041,18 +1025,13 @@ static int open_s(stream_t *stream,int m
      * Determine which program chain we want to watch.  This is based on the
      * chapter number.
      */
-    pgc_id = vts_file->vts_ptt_srpt->title[ttn].ptt[dvd_chapter].pgcn; // local
-    pgn  = vts_file->vts_ptt_srpt->title[ttn].ptt[dvd_chapter].pgn;  // local
+    pgc_id = vts_file->vts_ptt_srpt->title[ttn].ptt[0].pgcn; // local
+    pgn  = vts_file->vts_ptt_srpt->title[ttn].ptt[0].pgn;  // local
     d->cur_pgc_idx = pgc_id-1;
     d->cur_pgc = vts_file->vts_pgcit->pgci_srp[pgc_id-1].pgc;
     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[dvd_title].nr_of_ptts) {
-      pgn=vts_file->vts_ptt_srpt->title[ttn].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 ) 

Modified: trunk/stream/stream_dvdnav.c
==============================================================================
--- trunk/stream/stream_dvdnav.c	(original)
+++ trunk/stream/stream_dvdnav.c	Mon Feb 11 23:03:34 2008
@@ -558,17 +558,11 @@ static int open_s(stream_t *stream,int m
   }
 
   if(p->track > 0) {
-    if(dvd_chapter > 0 && dvd_last_chapter > 0 && dvd_chapter > dvd_last_chapter) {
-      mp_msg(MSGT_OPEN,MSGL_FATAL,"dvdnav_stream, invalid chapter range: %d > %d\n", dvd_chapter, dvd_last_chapter);
-      return STREAM_UNSUPPORTED;
-    }
     priv->title = p->track;
     if(dvdnav_title_play(priv->dvdnav, p->track) != DVDNAV_STATUS_OK) {
       mp_msg(MSGT_OPEN,MSGL_FATAL,"dvdnav_stream, couldn't select title %d, error '%s'\n", p->track, dvdnav_err_to_string(priv->dvdnav));
       return STREAM_UNSUPPORTED;
     }
-    if(dvd_chapter > 0)
-      dvdnav_part_play(priv->dvdnav, p->track, dvd_chapter);
   } else if (p->track == 0) {
     if(dvdnav_menu_call(priv->dvdnav, DVD_MENU_Root) != DVDNAV_STATUS_OK)
       dvdnav_menu_call(priv->dvdnav, DVD_MENU_Title);



More information about the MPlayer-cvslog mailing list