comparison libmpdemux/demux_mf.c @ 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 c5ee8c9808ef
children 0951c3e8864b
comparison
equal deleted inserted replaced
19219:7b6e341b72f5 19220:fbd2391fcbb8
138 if(!mf) 138 if(!mf)
139 return; 139 return;
140 free(mf); 140 free(mf);
141 } 141 }
142 142
143 static int demux_control_mf(demuxer_t *demuxer, int cmd, void *arg) {
144 mf_t *mf = (mf_t *)demuxer->priv;
145 sh_video_t *sh_video = demuxer->video->sh;
146
147 switch(cmd) {
148 case DEMUXER_CTRL_GET_TIME_LENGTH:
149 *((double *)arg) = (double)mf->nr_of_files / sh_video->fps;
150 return DEMUXER_CTRL_OK;
151
152 case DEMUXER_CTRL_GET_PERCENT_POS:
153 *((int *)arg) = 100 * mf->curr_frame / (mf->nr_of_files - 1);
154 return DEMUXER_CTRL_OK;
155
156 default:
157 return DEMUXER_CTRL_NOTIMPL;
158 }
159 }
143 160
144 demuxer_desc_t demuxer_desc_mf = { 161 demuxer_desc_t demuxer_desc_mf = {
145 "mf demuxer", 162 "mf demuxer",
146 "mf", 163 "mf",
147 "MF", 164 "MF",
152 NULL, 169 NULL,
153 demux_mf_fill_buffer, 170 demux_mf_fill_buffer,
154 demux_open_mf, 171 demux_open_mf,
155 demux_close_mf, 172 demux_close_mf,
156 demux_seek_mf, 173 demux_seek_mf,
157 NULL 174 demux_control_mf
158 }; 175 };