diff options
author | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2010-04-26 18:06:00 +0300 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2010-04-26 18:06:00 +0300 |
commit | 837c48ddeef9066f16c119f3cac412d37a25766a (patch) | |
tree | 61b95ec92e22522c8ccd07cd213f66dd56c1c197 /stream/stream_vcd.c | |
parent | e913d6c5dabcf342d8c1a7070382d712fc354948 (diff) | |
parent | 7bf961b1a3bbea070f40247417965493965729e1 (diff) | |
download | mpv-837c48ddeef9066f16c119f3cac412d37a25766a.tar.bz2 mpv-837c48ddeef9066f16c119f3cac412d37a25766a.tar.xz |
Merge svn changes up to r31020
Diffstat (limited to 'stream/stream_vcd.c')
-rw-r--r-- | stream/stream_vcd.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/stream/stream_vcd.c b/stream/stream_vcd.c index 0a69d595f0..9d698fef15 100644 --- a/stream/stream_vcd.c +++ b/stream/stream_vcd.c @@ -90,6 +90,40 @@ static int seek(stream_t *s,off_t newpos) { return 1; } +static int control(stream_t *stream, int cmd, void *arg) { + struct stream_priv_s *p = stream->priv; + switch(cmd) { + case STREAM_CTRL_GET_NUM_CHAPTERS: + { + mp_vcd_priv_t *vcd = vcd_read_toc(stream->fd); + if (!vcd) + break; + *(unsigned int *)arg = vcd->tochdr.cdth_trk1; + return STREAM_OK; + } + case STREAM_CTRL_SEEK_TO_CHAPTER: + { + int r; + unsigned int track = *(unsigned int *)arg + 1; + mp_vcd_priv_t *vcd = vcd_read_toc(stream->fd); + if (!vcd) + break; + r = vcd_seek_to_track(vcd, track); + if (r >= 0) { + p->track = track; + return STREAM_OK; + } + break; + } + case STREAM_CTRL_GET_CURRENT_CHAPTER: + { + *(unsigned int *)arg = p->track - 1; + return STREAM_OK; + } + } + return STREAM_UNSUPPORTED; +} + static void close_s(stream_t *stream) { free(stream->priv); } @@ -204,6 +238,7 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) { stream->fill_buffer = fill_buffer; stream->seek = seek; + stream->control = control; stream->close = close_s; *file_format = DEMUXER_TYPE_MPEG_PS; |