[MPlayer-cvslog] r31894 - trunk/stream/stream_dvd.c

diego subversion at mplayerhq.hu
Mon Aug 2 00:51:15 CEST 2010


Author: diego
Date: Mon Aug  2 00:51:15 2010
New Revision: 31894

Log:
dvd: Improve seeking by chapters.
The current code seeks to the start of the chapter. From this position, it then
tries to figure out the starting cell. This is completely suboptimal and error
prone since the starting cell can be directly deduced from the chapter.
patch by Olivier Rolland, billl users.sourceforge net

Modified:
   trunk/stream/stream_dvd.c

Modified: trunk/stream/stream_dvd.c
==============================================================================
--- trunk/stream/stream_dvd.c	Mon Aug  2 00:48:01 2010	(r31893)
+++ trunk/stream/stream_dvd.c	Mon Aug  2 00:51:15 2010	(r31894)
@@ -507,7 +507,7 @@ static int get_num_chapter(ifo_handle_t 
 
 static int seek_to_chapter(stream_t *stream, ifo_handle_t *vts_file, tt_srpt_t *tt_srpt, int title_no, int chapter)
 {
-    int cell;
+    dvd_priv_t *d = stream->priv;
     ptt_info_t ptt;
     pgc_t *pgc;
     off_t pos;
@@ -530,11 +530,18 @@ static int seek_to_chapter(stream_t *str
     ptt = vts_file->vts_ptt_srpt->title[title_no].ptt[chapter];
     pgc = vts_file->vts_pgcit->pgci_srp[ptt.pgcn-1].pgc;
 
-    cell = pgc->program_map[ptt.pgn - 1] - 1;
-    pos = (off_t) pgc->cell_playback[cell].first_sector * 2048;
+    d->cur_cell = pgc->program_map[ptt.pgn - 1] - 1;
+    if(pgc->cell_playback[d->cur_cell].block_type == BLOCK_TYPE_ANGLE_BLOCK)
+       d->cur_cell += dvd_angle;
+    d->cur_pack       = pgc->cell_playback[d->cur_cell].first_sector;
+    d->cell_last_pack = pgc->cell_playback[d->cur_cell].last_sector;
+
+    d->packs_left     = -1;
+    d->angle_seek     = 0;
+
+    pos = (off_t) d->cur_pack * 2048;
     mp_msg(MSGT_OPEN,MSGL_V,"\r\nSTREAM_DVD, seeked to chapter: %d, cell: %u, pos: %"PRIu64"\n",
-        chapter, pgc->cell_playback[cell].first_sector, pos);
-    stream_seek(stream, pos);
+        chapter, d->cur_pack, pos);
 
     return chapter;
 }


More information about the MPlayer-cvslog mailing list