[MPlayer-cvslog] r31019 - trunk/stream/stream_vcd.c
reimar
subversion at mplayerhq.hu
Mon Apr 5 18:40:05 CEST 2010
Author: reimar
Date: Mon Apr 5 18:40:04 2010
New Revision: 31019
Log:
Export VCD tracks as chapters, just like for cue:// URLs.
Modified:
trunk/stream/stream_vcd.c
Modified: trunk/stream/stream_vcd.c
==============================================================================
--- trunk/stream/stream_vcd.c Mon Apr 5 18:38:40 2010 (r31018)
+++ trunk/stream/stream_vcd.c Mon Apr 5 18:40:04 2010 (r31019)
@@ -91,6 +91,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);
}
@@ -203,6 +237,7 @@ static int open_s(stream_t *stream,int m
stream->fill_buffer = fill_buffer;
stream->seek = seek;
+ stream->control = control;
stream->close = close_s;
*file_format = DEMUXER_TYPE_MPEG_PS;
More information about the MPlayer-cvslog
mailing list