mirror of
https://github.com/mpv-player/mpv
synced 2025-01-02 04:42:10 +00:00
get_percent_pos support in demux_audio, patch by ROSEN Jeremy <jeremy.rosen at c-s.fr>
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10883 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
c585491872
commit
57e119d8be
@ -363,3 +363,24 @@ void demux_close_audio(demuxer_t* demuxer) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -1530,6 +1530,7 @@ extern int demux_asf_control(demuxer_t *demuxer, int cmd, void *arg);
|
||||
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 @@ int demux_control(demuxer_t *demuxer, int cmd, void *arg) {
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user