1
mirror of https://github.com/mpv-player/mpv synced 2025-01-13 00:06:25 +01:00

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
This commit is contained in:
diego 2010-08-01 22:51:15 +00:00 committed by Uoti Urpala
parent fdb6ce15df
commit 0a321e01e3

View File

@ -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;
}