From cb1dbb73a732925a2858793bfcf21b7f979dfa0d Mon Sep 17 00:00:00 2001 From: reimar Date: Fri, 28 Jul 2006 18:19:44 +0000 Subject: [PATCH] Implement DEMUXER_CTRL_GET_TIME_LENGTH and DEMUXER_CTRL_GET_PERCENT_POS, patch by Paul-Francois Fontigny pff at filmik be git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@19225 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/demux_mf.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/libmpdemux/demux_mf.c b/libmpdemux/demux_mf.c index ec5a7630d9..da49cb4813 100644 --- a/libmpdemux/demux_mf.c +++ b/libmpdemux/demux_mf.c @@ -140,6 +140,23 @@ static void demux_close_mf(demuxer_t* demuxer) { 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 @@ demuxer_desc_t demuxer_desc_mf = { demux_open_mf, demux_close_mf, demux_seek_mf, - NULL + demux_control_mf };