[MPlayer-users] a small bug and a new feature

ROSEN Jeremy jeremy.rosen at c-s.fr
Wed Jul 30 16:16:24 CEST 2003

Hello everybody
I hope I post to the right mailing list... bugreport.html recomends
posting to adv-users which doesn't seem to exist....

first of all thank you and congratulation. Mplayer is a great software,

Actually, I intend to use it as a back end for my audio playing daemon,
but I have a reproducable crash
and a couple of annoying problems when using mplayer with audio files.

first the crash:

when I run "mplayer -slave <audiofile> " then while playing I send the
following command "loadfile <anyfile>" I get a crash
audiofil has been tested with wma and mp3, anyfile with mp", wma and a
couple of avi and mpg files
a quick gdb run as documented in bugreport.html provides the following
crash happens at mplayer.c, in main line 3314 the line is
int pts = sh_video->pts

OK, the bug seems obvious, this variable seems not to be initialised for
audio files. but I have no idea how to fix it, so I hope someone can fix
it for me... thanks in advance

Now the feature

Mplayer is not able to answer get_percent_pos and get_song_length for
audio file...
I've added what was needed, it works but I am not 100% sure that's the
correct guess. It's based on what demux_xmms does to answer the
queries.... I don't know the mplayer codebase very well. (based on CVS
from monday evening)

follows is all the version stuff required to have a proper bug report

Hope this helps...



Debian unstabale
Linux pcrosen 2.4.20 #1 Mon May 5 21:59:55 CEST 2003 i686 GNU/Linux
-rwxr-xr-x    1 root     root      1103880 2003-04-19 20:57
lrwxrwxrwx    1 root     root           13 2003-05-17 15:47
/lib/libc.so.6 -> libc-2.3.1.so

This is a pre-release version of XFree86, and is not supported in any
way.  Bugs may be reported to XFree86 at XFree86.Org and patches submitted
to fixes at XFree86.Org.  Before reporting bugs in pre-release versions,
please check the latest version in the XFree86 CVS repository

XFree86 Version (Debian 4.2.1-6 20030225230350
branden at progeny.com) / X Window System
(protocol Version 11, revision 0, vendor release 6600)
Release Date: 18 October 2002
	If the server is older than 6-12 months, or if your card is
	newer than the above date, look for a newer version before
	reporting problems.  (See http://www.XFree86.Org/)
Build Operating System: Linux 2.4.20-586tsc i686 [ELF] 
Module Loader present

Lecture des spécification à partir de
Configuré avec: ../src/configure -v
--enable-languages=c,c++,java,f77,objc,ada --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-gxx-include-dir=/usr/include/c++/3.2 --enable-shared
--with-system-zlib --enable-nls --without-included-gettext
--enable-__cxa_atexit --enable-clocale=gnu --enable-java-gc=boehm
--enable-objc-gc i386-linux
Modèle de thread: posix
version gcc 3.2.3

GNU ld version 20030523 Debian GNU/Linux

Assembleur GNU 20030523 Debian GNU/Linux
Copyright 2002 Free Software Foundation, Inc.
Ce logiciel est libre; vous pouvez le redistribuer selon les termes de
licence GNU General Public License. AUCUNE garantie n'est donnée.
Cet assembleur a été configuré pour la cible « i386-linux ».

processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 6
model name	: Celeron (Mendocino)
stepping	: 5
cpu MHz		: 367.504
cache size	: 128 KB
fdiv_bug	: no
hlt_bug		: no
f00f_bug	: no
coma_bug	: no
fpu		: yes
fpu_exception	: yes
cpuid level	: 2
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 sep mtrr pge mca cmov pat
pse36 mmx fxsr
bogomips	: 734.00

ati rage 128, avec driver X standard
-------------- next part --------------
Index: libmpdemux/demux_audio.c
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_audio.c,v
retrieving revision 1.21
diff -u -r1.21 demux_audio.c
--- libmpdemux/demux_audio.c	4 Jun 2003 10:52:58 -0000	1.21
+++ libmpdemux/demux_audio.c	28 Jul 2003 21:17:41 -0000
@@ -363,3 +363,24 @@
+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) {
+	    if (audio_length<=0) return DEMUXER_CTRL_DONTKNOW;
+	    *((unsigned long *)arg)=(unsigned long)audio_length;
+	    return DEMUXER_CTRL_GUESS;
+	    if (audio_length<=0) 
+    	    *((int *)arg)=(int)( (priv->last_pts*100)  / audio_length);
+	    return DEMUXER_CTRL_OK;
+	default:
+    }
Index: libmpdemux/demuxer.c
RCS file: /cvsroot/mplayer/main/libmpdemux/demuxer.c,v
retrieving revision 1.149
diff -u -r1.149 demuxer.c
--- libmpdemux/demuxer.c	19 Jul 2003 17:39:47 -0000	1.149
+++ libmpdemux/demuxer.c	28 Jul 2003 21:17:45 -0000
@@ -1525,6 +1525,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) {
@@ -1540,6 +1541,8 @@
 	    return demux_avi_control(demuxer,cmd,arg);
+	    return demux_audio_control(demuxer,cmd,arg);
 #ifdef HAVE_XMMS
 	    return demux_xmms_control(demuxer,cmd,arg);

More information about the MPlayer-users mailing list