Mercurial > mplayer.hg
changeset 19220:fbd2391fcbb8
Implement DEMUXER_CTRL_GET_TIME_LENGTH and DEMUXER_CTRL_GET_PERCENT_POS,
patch by Paul-Francois Fontigny pff at filmik be
author | reimar |
---|---|
date | Fri, 28 Jul 2006 18:19:44 +0000 |
parents | 7b6e341b72f5 |
children | 62ff089c24f7 |
files | libmpdemux/demux_mf.c |
diffstat | 1 files changed, 18 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpdemux/demux_mf.c Fri Jul 28 17:56:38 2006 +0000 +++ b/libmpdemux/demux_mf.c Fri Jul 28 18:19:44 2006 +0000 @@ -140,6 +140,23 @@ free(mf); } +static int demux_control_mf(demuxer_t *demuxer, int cmd, void *arg) { + mf_t *mf = (mf_t *)demuxer->priv; + sh_video_t *sh_video = demuxer->video->sh; + + switch(cmd) { + case DEMUXER_CTRL_GET_TIME_LENGTH: + *((double *)arg) = (double)mf->nr_of_files / sh_video->fps; + return DEMUXER_CTRL_OK; + + case DEMUXER_CTRL_GET_PERCENT_POS: + *((int *)arg) = 100 * mf->curr_frame / (mf->nr_of_files - 1); + return DEMUXER_CTRL_OK; + + default: + return DEMUXER_CTRL_NOTIMPL; + } +} demuxer_desc_t demuxer_desc_mf = { "mf demuxer", @@ -154,5 +171,5 @@ demux_open_mf, demux_close_mf, demux_seek_mf, - NULL + demux_control_mf };