Mercurial > mplayer.hg
changeset 30765:3e230b384997
Implement cue:// track switching via chapter forward/backward like for audio CDs.
author | reimar |
---|---|
date | Mon, 01 Mar 2010 19:59:54 +0000 |
parents | 0987402cd276 |
children | 6c5e12f5820b |
files | stream/stream_cue.c |
diffstat | 1 files changed, 28 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/stream/stream_cue.c Mon Mar 01 19:57:42 2010 +0000 +++ b/stream/stream_cue.c Mon Mar 01 19:59:54 2010 +0000 @@ -545,6 +545,33 @@ return 1; } +static int control(stream_t *stream, int cmd, void *arg) { + switch(cmd) { + case STREAM_CTRL_GET_NUM_CHAPTERS: + { + *(unsigned int *)arg = nTracks; + return STREAM_OK; + } + case STREAM_CTRL_SEEK_TO_CHAPTER: + { + int r; + unsigned int track = *(unsigned int *)arg; + r = cue_vcd_seek_to_track(track); + if (r >= 0) { + stream->start_pos = r; + stream->end_pos = cue_vcd_get_track_end(track); + return STREAM_OK; + } + break; + } + case STREAM_CTRL_GET_CURRENT_CHAPTER: + { + *(unsigned int *)arg = cue_current_pos.track; + return STREAM_OK; + } + } + return STREAM_UNSUPPORTED; +} static int open_s(stream_t *stream,int mode, void* opts, int* file_format) { struct stream_priv_s* p = (struct stream_priv_s*)opts; @@ -591,6 +618,7 @@ stream->end_pos = ret2; stream->fill_buffer = cue_vcd_read; stream->seek = seek; + stream->control = control; free(filename); m_struct_free(&stream_opts,opts);