summaryrefslogtreecommitdiffstats
path: root/stream
diff options
context:
space:
mode:
authornicodvb <nicodvb@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-08-18 19:05:37 +0000
committernicodvb <nicodvb@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-08-18 19:05:37 +0000
commitc5f2783e20f258839a07b61f381187082e0de268 (patch)
tree066fcfff01dffb319e2773ac8e8a8deaa2857346 /stream
parent1870190d37b6ddbea43625ca5d06fc48ba7e003c (diff)
downloadmpv-c5f2783e20f258839a07b61f381187082e0de268.tar.bz2
mpv-c5f2783e20f258839a07b61f381187082e0de268.tar.xz
support for seeking to chapter and getting current playing chapter
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@19446 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'stream')
-rw-r--r--stream/stream_dvd.c39
1 files changed, 38 insertions, 1 deletions
diff --git a/stream/stream_dvd.c b/stream/stream_dvd.c
index 2abed6061c..de80f30971 100644
--- a/stream/stream_dvd.c
+++ b/stream/stream_dvd.c
@@ -479,16 +479,53 @@ static int mp_describe_titleset(dvd_reader_t *dvd, tt_srpt_t *tt_srpt, int vts_n
return 1;
}
+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;
+ ptt_info_t ptt;
+ pgc_t *pgc;
+ off_t pos;
+
+ if(!vts_file || !tt_srpt)
+ return 0;
+
+ if(chapter < 0 || chapter > vts_file->vts_ptt_srpt->title[title_no].nr_of_ptts) //no such chapter
+ return 0;
+
+ 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;
+ 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);
+
+ return chapter;
+}
+
static int control(stream_t *stream,int cmd,void* arg)
{
+ dvd_priv_t *d = stream->priv;
switch(cmd)
{
case STREAM_CTRL_GET_TIME_LENGTH:
{
- dvd_priv_t *d = stream->priv;
*((unsigned int *)arg) = mp_get_titleset_length(d->vts_file, d->tt_srpt, d->cur_title-1);
return 1;
}
+ case STREAM_CTRL_SEEK_TO_CHAPTER:
+ {
+ int r = seek_to_chapter(stream, d->vts_file, d->tt_srpt, d->cur_title-1, *((unsigned int *)arg));
+ if(! r) return STREAM_UNSUPORTED;
+
+ return 1;
+ }
+ case STREAM_CTRL_GET_CURRENT_CHAPTER:
+ {
+ *((unsigned int *)arg) = dvd_chapter_from_cell(d, d->cur_title-1, d->cur_cell);
+ return 1;
+ }
}
return STREAM_UNSUPORTED;
}