summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordiego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-08-01 22:51:15 +0000
committerUoti Urpala <uau@glyph.nonexistent.invalid>2010-11-02 04:15:01 +0200
commit0a321e01e3657ed29219623696ce0963044e38f7 (patch)
treee63e5f986419738c67d1b9faa3dde3d1322be021
parentfdb6ce15df046e6e0117b978d0aa6b4748079fac (diff)
downloadmpv-0a321e01e3657ed29219623696ce0963044e38f7.tar.bz2
mpv-0a321e01e3657ed29219623696ce0963044e38f7.tar.xz
stream_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 git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31894 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--stream/stream_dvd.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/stream/stream_dvd.c b/stream/stream_dvd.c
index 939c20177a..80ce205417 100644
--- a/stream/stream_dvd.c
+++ b/stream/stream_dvd.c
@@ -468,7 +468,7 @@ static int get_num_chapter(ifo_handle_t *vts_file, tt_srpt_t *tt_srpt, int title
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;
@@ -491,11 +491,18 @@ static int seek_to_chapter(stream_t *stream, ifo_handle_t *vts_file, tt_srpt_t *
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;
}