[Mplayer-cvslog] CVS: main/libmpdemux demux_audio.c,1.21,1.22 demuxer.c,1.151,1.152
Sascha Sommer CVS
faust3 at mplayerhq.hu
Fri Sep 19 21:41:18 CEST 2003
Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var/tmp.root/cvs-serv27232/libmpdemux
Modified Files:
demux_audio.c demuxer.c
Log Message:
get_percent_pos support in demux_audio, patch by ROSEN Jeremy <jeremy.rosen at c-s.fr>
Index: demux_audio.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_audio.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- demux_audio.c 4 Jun 2003 10:52:58 -0000 1.21
+++ demux_audio.c 19 Sep 2003 19:40:46 -0000 1.22
@@ -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;
+ }
+}
Index: demuxer.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demuxer.c,v
retrieving revision 1.151
retrieving revision 1.152
diff -u -r1.151 -r1.152
--- demuxer.c 24 Aug 2003 18:08:54 -0000 1.151
+++ demuxer.c 19 Sep 2003 19:40:46 -0000 1.152
@@ -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);
More information about the MPlayer-cvslog
mailing list