Mercurial > mplayer.hg
changeset 10882:e46e5a6c53b8
get_percent_pos support in demux_audio, patch by ROSEN Jeremy <jeremy.rosen at c-s.fr>
author | faust3 |
---|---|
date | Fri, 19 Sep 2003 19:40:46 +0000 |
parents | 6c3555f4c5c3 |
children | 5977670f744e |
files | libmpdemux/demux_audio.c libmpdemux/demuxer.c |
diffstat | 2 files changed, 24 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpdemux/demux_audio.c Fri Sep 19 18:45:02 2003 +0000 +++ b/libmpdemux/demux_audio.c Fri Sep 19 19:40:46 2003 +0000 @@ -363,3 +363,24 @@ free(priv); } +int demux_audio_control(demuxer_t *demuxer,int cmd, void *arg){ + sh_audio_t *sh_audio=demuxer->audio->sh; + int audio_length = demuxer->movi_end / sh_audio->i_bps; + da_priv_t* priv = demuxer->priv; + + switch(cmd) { + case DEMUXER_CTRL_GET_TIME_LENGTH: + if (audio_length<=0) return DEMUXER_CTRL_DONTKNOW; + *((unsigned long *)arg)=(unsigned long)audio_length; + return DEMUXER_CTRL_GUESS; + + case DEMUXER_CTRL_GET_PERCENT_POS: + if (audio_length<=0) + return DEMUXER_CTRL_DONTKNOW; + *((int *)arg)=(int)( (priv->last_pts*100) / audio_length); + return DEMUXER_CTRL_OK; + + default: + return DEMUXER_CTRL_NOTIMPL; + } +}
--- a/libmpdemux/demuxer.c Fri Sep 19 18:45:02 2003 +0000 +++ b/libmpdemux/demuxer.c Fri Sep 19 19:40:46 2003 +0000 @@ -1530,6 +1530,7 @@ extern int demux_avi_control(demuxer_t *demuxer, int cmd, void *arg); extern int demux_xmms_control(demuxer_t *demuxer, int cmd, void *arg); extern int demux_mkv_control(demuxer_t *demuxer, int cmd, void *arg); +extern int demux_audio_control(demuxer_t *demuxer, int cmd, void *arg); int demux_control(demuxer_t *demuxer, int cmd, void *arg) { switch(demuxer->type) { @@ -1547,6 +1548,8 @@ case DEMUXER_TYPE_AVI_NI: case DEMUXER_TYPE_AVI_NINI: return demux_avi_control(demuxer,cmd,arg); + case DEMUXER_TYPE_AUDIO: + return demux_audio_control(demuxer,cmd,arg); #ifdef HAVE_XMMS case DEMUXER_TYPE_XMMS: return demux_xmms_control(demuxer,cmd,arg);