[MPlayer-cvslog] r29525 - trunk/libmpdemux/demux_rawaudio.c

reimar subversion at mplayerhq.hu
Mon Aug 17 00:39:10 CEST 2009


Author: reimar
Date: Mon Aug 17 00:39:10 2009
New Revision: 29525

Log:
Implement DEMUXER_CTRL_GET_TIME_LENGTH and DEMUXER_CTRL_GET_PERCENT_POS for
rawaudio demuxer.

Modified:
   trunk/libmpdemux/demux_rawaudio.c

Modified: trunk/libmpdemux/demux_rawaudio.c
==============================================================================
--- trunk/libmpdemux/demux_rawaudio.c	Sun Aug 16 23:37:07 2009	(r29524)
+++ trunk/libmpdemux/demux_rawaudio.c	Mon Aug 17 00:39:10 2009	(r29525)
@@ -112,6 +112,23 @@ static void demux_rawaudio_seek(demuxer_
 //  printf("demux_rawaudio: streamtell=%d\n",(int)stream_tell(demuxer->stream));
 }
 
+static int demux_rawaudio_control(demuxer_t *demuxer,int cmd, void *arg)
+{
+  sh_audio_t *sh_audio = demuxer->audio->sh;
+  switch(cmd) {
+  case DEMUXER_CTRL_GET_TIME_LENGTH:
+    if (!sh_audio->i_bps) return DEMUXER_CTRL_DONTKNOW;
+    *(double *)arg = (double)(demuxer->movi_end - demuxer->movi_start) / sh_audio->i_bps;
+    return DEMUXER_CTRL_GUESS;
+
+  case DEMUXER_CTRL_GET_PERCENT_POS:
+    *(int *)arg = (stream_tell(demuxer->stream) - demuxer->movi_start) * 100 / (demuxer->movi_end - demuxer->movi_start);
+    return DEMUXER_CTRL_GUESS;
+  }
+  return DEMUXER_CTRL_NOTIMPL;
+}
+
+
 
 const demuxer_desc_t demuxer_desc_rawaudio = {
   "Raw audio demuxer",
@@ -126,5 +143,5 @@ const demuxer_desc_t demuxer_desc_rawaud
   demux_rawaudio_open,
   NULL,
   demux_rawaudio_seek,
-  NULL
+  demux_rawaudio_control
 };


More information about the MPlayer-cvslog mailing list