changeset 440:d19a3da6ac13

Pontscho's mixer, select, and hell-a-lot-of-stuff patch ;)
author gabucino
date Sun, 15 Apr 2001 18:35:17 +0000
parents fc760523e55a
children c4b4e2aac9de
files DOCS/LIRC DOCS/SOUNDCARDS Makefile cfg-mplayer.h configure help_mp.h libvo/wskeys.h libvo/x11_common.c lirc_mp.c mplayer.c
diffstat 10 files changed, 391 insertions(+), 398 deletions(-) [+]
line wrap: on
line diff
--- a/DOCS/LIRC	Sun Apr 15 18:27:51 2001 +0000
+++ b/DOCS/LIRC	Sun Apr 15 18:35:17 2001 +0000
@@ -29,6 +29,10 @@
  FRWND  - 60 secs back
  FWD    - skip 10 secs
  FFWD   - skip 60 secs
+ INCVOL - increase volume one percent
+ DECVOL - decrease volmue one percent
+ MASTER - use master mixer channel
+ PCM    - use pcm mixer channel
 
  Don't forget to enable the repeat flag for RWND/FWD in .lircrc. Here's an
  excerpt from my .lircrc:
--- a/DOCS/SOUNDCARDS	Sun Apr 15 18:27:51 2001 +0000
+++ b/DOCS/SOUNDCARDS	Sun Apr 15 18:35:17 2001 +0000
@@ -2,12 +2,11 @@
 Recommendations for misc. soundcards
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-Aureal Vortex 2: (Pontscho)
-			In config.h, change #define HAVE_AUDIO_SELECT to
-			  #undef HAVE_AUDIO_SELECT
-			OSS	: With MPEG files : defaults are ok
-				  With AVI files  : -delay -0.5
-			ALSA	: same
+Aureal Vortex 2:        In config.h, change #define HAVE_AUDIO_SELECT to
+			  #undef HAVE_AUDIO_SELECT or run 
+			  ./configure script with --disable-select option
+			  
+ALSA with GUS PnP:	see Aureal Vortex2
 
 SB Live!:
 			OSS	: OK
--- a/Makefile	Sun Apr 15 18:27:51 2001 +0000
+++ b/Makefile	Sun Apr 15 18:35:17 2001 +0000
@@ -22,8 +22,8 @@
 prefix = /usr/local
 BINDIR = ${prefix}/bin
 # BINDIR = /usr/local/bin
-SRCS = codec-cfg.c subreader.c linux/getch2.c linux/timer-lx.c linux/shmem.c xa/xa_gsm.c lirc_mp.c cfgparser.c
-OBJS = codec-cfg.o subreader.o linux/getch2.o linux/timer-lx.o linux/shmem.o xa/xa_gsm.o lirc_mp.o cfgparser.o
+SRCS = codec-cfg.c subreader.c linux/getch2.c linux/timer-lx.c linux/shmem.c xa/xa_gsm.c lirc_mp.c cfgparser.c mixer.c
+OBJS = codec-cfg.o subreader.o linux/getch2.o linux/timer-lx.o linux/shmem.o xa/xa_gsm.o lirc_mp.o cfgparser.o mixer.o
 CFLAGS = $(OPTFLAGS) -Iloader -Ilibvo # -Wall
 A_LIBS = -Lmp3lib -lMP3 -Llibac3 -lac3
 VO_LIBS = -Llibvo -lvo $(X_LIBS)
@@ -32,7 +32,7 @@
 
 # .PHONY: all clean
 
-all:	version.h $(PRG) $(PRG_CFG)
+all:	$(PRG) $(PRG_CFG)
 # $(PRG_AVIP)
 
 .c.o:
@@ -65,6 +65,7 @@
 	$(MAKE) -C encore
 
 $(PRG):	.depend mplayer.o $(OBJS) loader/libloader.a loader/DirectShow/libDS_Filter.a libmpeg2/libmpeg2.a opendivx/libdecore.a $(COMMONLIBS) encore/libencore.a
+	@for a in mp3lib libac3 libmpeg2 opendivx encore libvo loader loader/DirectShow drivers drivers/syncfb ; do $(MAKE) -C $$a; done
 	$(CC) $(CFLAGS) -o $(PRG) mplayer.o $(OBJS) $(XMM_LIBS) $(LIRC_LIBS) $(A_LIBS) -lm $(TERMCAP_LIB) -Lloader -lloader -Lloader/DirectShow -lDS_Filter -ldl -Llibmpeg2 -lmpeg2 -Lopendivx -ldecore $(VO_LIBS) -Lencore -lencore -lpthread -lstdc++
 
 $(PRG_HQ):	.depend mplayerHQ.o $(OBJS) loader/libloader.a libmpeg2/libmpeg2.a opendivx/libdecore.a $(COMMONLIBS) encore/libencore.a
@@ -76,7 +77,7 @@
 $(PRG_TV):	.depend tvision.o $(OBJS) $(COMMONLIBS)
 	$(CC) $(CFLAGS) -o $(PRG_TV) tvision.o $(OBJS) -lm $(TERMCAP_LIB) $(VO_LIBS)
 
-$(PRG_CFG):        .depend codec-cfg.c codec-cfg.h
+$(PRG_CFG):        codec-cfg.c codec-cfg.h
 	$(CC) $(CFLAGS) -g codec-cfg.c -o $(PRG_CFG) -DTESTING
 
 install: $(PRG)
@@ -98,20 +99,9 @@
 .depend: Makefile config.mak config.h
 	makedepend -f- -- $(CFLAGS) -- mplayer.c mplayerHQ.c aviparse.c tvision.c $(SRCS) 1>.depend 2>/dev/null
 
-# rebuild at every config.h/config.mak change:
-version.h: config.h config.mak Makefile
-	$(MAKE) distclean
-	./version.sh
-
-# rebuild at every CVS update:
-ifneq ($(wildcard CVS/Entries),)
-version.h: CVS/Entries
-endif
-
 #
 # include dependency files if they exist
 #
 ifneq ($(wildcard .depend),)
 include .depend
 endif
-
--- a/cfg-mplayer.h	Sun Apr 15 18:27:51 2001 +0000
+++ b/cfg-mplayer.h	Sun Apr 15 18:35:17 2001 +0000
@@ -6,78 +6,76 @@
 extern char *fb_dev_name;
 extern char *fb_mode_cfgfile;
 extern char *fb_mode_name;
-extern char *monitor_hfreq_str;
-extern char *monitor_vfreq_str;
-extern char *monitor_dotclock_str;
+extern int fb_mode_depth;
 #endif
 
 struct config conf[]={
-	/* name, pointer, type, flags, min, max */
-	{"include", cfg_include, CONF_TYPE_FUNC_PARAM, 0, 0, 0}, /* this must be the first!!! */
-	{"o", "Option -o has been renamed to -vo (video-out), use -vo !\n",
+        /* name, pointer, type, flags, min, max */
+        {"include", cfg_include, CONF_TYPE_FUNC_PARAM, 0, 0, 0}, /* this must be the first!!! */
+        {"o", "Option -o has been renamed to -vo (video-out), use -vo !\n",
             CONF_TYPE_PRINT, CONF_NOCFG, 0, 0},
-	{"vo", &video_driver, CONF_TYPE_STRING, 0, 0, 0},
-	{"dsp", &dsp, CONF_TYPE_STRING, 0, 0, 0},
+        {"vo", &video_driver, CONF_TYPE_STRING, 0, 0, 0},
+        {"dsp", &dsp, CONF_TYPE_STRING, 0, 0, 0},
+        {"mixer", &mixer_device, CONF_TYPE_STRING, 0, 0, 0},
+        {"master", &mixer_usemaster, CONF_TYPE_FLAG, 0, 0, 1},
 #ifdef HAVE_FBDEV
-	{"fb", &fb_dev_name, CONF_TYPE_STRING, 0, 0, 0},
-	{"fbmode", &fb_mode_name, CONF_TYPE_STRING, 0, 0, 0},
-	{"fbmodeconfig", &fb_mode_cfgfile, CONF_TYPE_STRING, 0, 0, 0},
-	{"monitor_hfreq", &monitor_hfreq_str, CONF_TYPE_STRING, 0, 0, 0},
-	{"monitor_vfreq", &monitor_vfreq_str, CONF_TYPE_STRING, 0, 0, 0},
-	{"monitor_dotclock", &monitor_dotclock_str, CONF_TYPE_STRING, 0, 0, 0},
+        {"fb", &fb_dev_name, CONF_TYPE_STRING, 0, 0, 0},
+        {"fbmode", &fb_mode_name, CONF_TYPE_STRING, 0, 0, 0},
+        {"fbmodeconfig", &fb_mode_cfgfile, CONF_TYPE_STRING, 0, 0, 0},
+        {"fbdepth", &fb_mode_depth, CONF_TYPE_INT, CONF_RANGE, 15, 32},
 #endif
-	{"encode", &encode_name, CONF_TYPE_STRING, 0, 0, 0},
-	{"sub", &sub_name, CONF_TYPE_STRING, 0, 0, 0},
-	{"subdelay", &sub_delay, CONF_TYPE_FLOAT, 0, 0.0, 10.0},
-	{"subfps", &sub_fps, CONF_TYPE_FLOAT, 0, 0.0, 10.0},
-	{"font", &font_name, CONF_TYPE_STRING, 0, 0, 0},
-	{"ffactor", &font_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 10.0},
-	{"bg", &play_in_bg, CONF_TYPE_FLAG, 0, 0, 1},
-	{"nobg", &play_in_bg, CONF_TYPE_FLAG, 0, 1, 0},
-	{"sb", &seek_to_byte, CONF_TYPE_INT, CONF_MIN, 0, 0},
-//	{"ss", &seek_to_sec, CONF_TYPE_INT, CONF_MIN, 0, 0},
-	{"sound", &has_audio, CONF_TYPE_FLAG, 0, 0, 1},
-	{"nosound", &has_audio, CONF_TYPE_FLAG, 0, 1, 0},
-	{"abs", &audio_buffer_size, CONF_TYPE_INT, CONF_MIN, 0, 0},
-	{"delay", &audio_delay, CONF_TYPE_FLOAT, CONF_RANGE, -10.0, 10.0},
-	{"bps", &pts_from_bps, CONF_TYPE_FLAG, 0, 0, 1},
-	{"nobps", &pts_from_bps, CONF_TYPE_FLAG, 0, 1, 0},
-	{"alsa", &alsa, CONF_TYPE_FLAG, 0, 0, 1},
-	{"noalsa", &alsa, CONF_TYPE_FLAG, 0, 1, 0},
-	{"ni", &force_ni, CONF_TYPE_FLAG, 0, 0, 1},
-	{"noni", &force_ni, CONF_TYPE_FLAG, 0, 1, 0},
-	{"aid", &audio_id, CONF_TYPE_INT, CONF_RANGE, 0, 256},
-	{"vid", &video_id, CONF_TYPE_INT, CONF_RANGE, 0, 256},
-//	{"auds", &avi_header.audio_codec, CONF_TYPE_STRING, 0, 0, 0},
-//	{"vids", &avi_header.video_codec, CONF_TYPE_STRING, 0, 0, 0},
-	{"mc", &default_max_pts_correction, CONF_TYPE_FLOAT, CONF_RANGE, 0, 10},
-	{"fps", &force_fps, CONF_TYPE_FLOAT, CONF_MIN, 0, 0},
-	{"afm", &audio_format, CONF_TYPE_INT, CONF_RANGE, 1, 6},
-	{"vcd", &vcd_track, CONF_TYPE_INT, CONF_RANGE, 1, 99},
-	{"divxq", "Option -divxq has been renamed to -pp (postprocessing), use -pp !\n",
+        {"encode", &encode_name, CONF_TYPE_STRING, 0, 0, 0},
+        {"sub", &sub_name, CONF_TYPE_STRING, 0, 0, 0},
+        {"subdelay", &sub_delay, CONF_TYPE_FLOAT, 0, 0.0, 10.0},
+        {"subfps", &sub_fps, CONF_TYPE_FLOAT, 0, 0.0, 10.0},
+        {"font", &font_name, CONF_TYPE_STRING, 0, 0, 0},
+        {"ffactor", &font_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 10.0},
+        {"bg", &play_in_bg, CONF_TYPE_FLAG, 0, 0, 1},
+        {"nobg", &play_in_bg, CONF_TYPE_FLAG, 0, 1, 0},
+        {"sb", &seek_to_byte, CONF_TYPE_INT, CONF_MIN, 0, 0},
+//      {"ss", &seek_to_sec, CONF_TYPE_INT, CONF_MIN, 0, 0},
+        {"sound", &has_audio, CONF_TYPE_FLAG, 0, 0, 1},
+        {"nosound", &has_audio, CONF_TYPE_FLAG, 0, 1, 0},
+        {"abs", &audio_buffer_size, CONF_TYPE_INT, CONF_MIN, 0, 0},
+        {"delay", &audio_delay, CONF_TYPE_FLOAT, CONF_RANGE, -10.0, 10.0},
+        {"bps", &pts_from_bps, CONF_TYPE_FLAG, 0, 0, 1},
+        {"nobps", &pts_from_bps, CONF_TYPE_FLAG, 0, 1, 0},
+        {"alsa", &alsa, CONF_TYPE_FLAG, 0, 0, 1},
+        {"noalsa", &alsa, CONF_TYPE_FLAG, 0, 1, 0},
+        {"ni", &force_ni, CONF_TYPE_FLAG, 0, 0, 1},
+        {"noni", &force_ni, CONF_TYPE_FLAG, 0, 1, 0},
+        {"aid", &audio_id, CONF_TYPE_INT, CONF_RANGE, 0, 256},
+        {"vid", &video_id, CONF_TYPE_INT, CONF_RANGE, 0, 256},
+//      {"auds", &avi_header.audio_codec, CONF_TYPE_STRING, 0, 0, 0},
+//      {"vids", &avi_header.video_codec, CONF_TYPE_STRING, 0, 0, 0},
+        {"mc", &default_max_pts_correction, CONF_TYPE_FLOAT, CONF_RANGE, 0, 10},
+        {"fps", &force_fps, CONF_TYPE_FLOAT, CONF_MIN, 0, 0},
+        {"afm", &audio_format, CONF_TYPE_INT, CONF_RANGE, 1, 6},
+        {"vcd", &vcd_track, CONF_TYPE_INT, CONF_RANGE, 1, 99},
+        {"divxq", "Option -divxq has been renamed to -pp (postprocessing), use -pp !\n",
             CONF_TYPE_PRINT, 0, 0, 0},
-	{"pp", &divx_quality, CONF_TYPE_INT, CONF_RANGE, 0, 63},
-	{"br", &encode_bitrate, CONF_TYPE_INT, CONF_RANGE, 10000, 10000000},
+        {"pp", &divx_quality, CONF_TYPE_INT, CONF_RANGE, 0, 63},
+        {"br", &encode_bitrate, CONF_TYPE_INT, CONF_RANGE, 10000, 10000000},
 
-	{"x", &screen_size_x, CONF_TYPE_INT, CONF_RANGE, 1, 4096},
-	{"y", &screen_size_y, CONF_TYPE_INT, CONF_RANGE, 1, 4096},
-	{"xy", &screen_size_xy, CONF_TYPE_INT, CONF_RANGE, 1, 4096},
+        {"x", &screen_size_x, CONF_TYPE_INT, CONF_RANGE, 1, 4096},
+        {"y", &screen_size_y, CONF_TYPE_INT, CONF_RANGE, 1, 4096},
+        {"xy", &screen_size_xy, CONF_TYPE_INT, CONF_RANGE, 1, 4096},
         {"vm", &vidmode, CONF_TYPE_FLAG, 0, 0, 1},
         {"novm", &vidmode, CONF_TYPE_FLAG, 0, 1, 0},
-	{"fs", &fullscreen, CONF_TYPE_FLAG, 0, 0, 1},
-	{"nofs", &fullscreen, CONF_TYPE_FLAG, 0, 1, 0},
+        {"fs", &fullscreen, CONF_TYPE_FLAG, 0, 0, 1},
+        {"nofs", &fullscreen, CONF_TYPE_FLAG, 0, 1, 0},
         {"zoom", &softzoom, CONF_TYPE_FLAG, 0, 0, 1},
         {"nozoom", &softzoom, CONF_TYPE_FLAG, 0, 1, 0},
-       
+
         {"bpp", &vo_dbpp, CONF_TYPE_INT, CONF_RANGE, 0, 32},
-	
-	{"idx", &no_index, CONF_TYPE_FLAG, 0, 1, 0},
-	{"noidx", &no_index, CONF_TYPE_FLAG, 0, 0, 1},
-	{"verbose", &verbose, CONF_TYPE_INT, CONF_RANGE, 0, 100},
-	{"v", cfg_inc_verbose, CONF_TYPE_FUNC, 0, 0, 0},
-	{"-help", help_text, CONF_TYPE_PRINT, CONF_NOCFG, 0, 0},
-	{"help", help_text, CONF_TYPE_PRINT, CONF_NOCFG, 0, 0},
-	{"h", help_text, CONF_TYPE_PRINT, CONF_NOCFG, 0, 0},
-	{NULL, NULL, 0, 0, 0, 0}
+
+        {"idx", &no_index, CONF_TYPE_FLAG, 0, 1, 0},
+        {"noidx", &no_index, CONF_TYPE_FLAG, 0, 0, 1},
+        {"verbose", &verbose, CONF_TYPE_INT, CONF_RANGE, 0, 100},
+        {"v", cfg_inc_verbose, CONF_TYPE_FUNC, 0, 0, 0},
+        {"-help", help_text, CONF_TYPE_PRINT, CONF_NOCFG, 0, 0},
+        {"help", help_text, CONF_TYPE_PRINT, CONF_NOCFG, 0, 0},
+        {"h", help_text, CONF_TYPE_PRINT, CONF_NOCFG, 0, 0},
+        {NULL, NULL, 0, 0, 0, 0}
 };
 
--- a/configure	Sun Apr 15 18:27:51 2001 +0000
+++ b/configure	Sun Apr 15 18:35:17 2001 +0000
@@ -6,6 +6,10 @@
 #
 # Changes in reversed order:
 #
+# 2001/04/15 by Pontscho
+#  - added --disable-select option
+#  - added X11DIR variable in config.mak and fix syncfb Makefile -L/usr/X11/lib bug 
+#
 # 2001/03/24 by Mike Graffam:
 #  - added autodetect code for XF86VidMode, along with explicit --enable-vm
 #
@@ -89,7 +93,10 @@
 
 	--enable-termcap	use termcap database for key codes
 	--enable-xmmp	        use XMMP audio drivers
-	--enable-lirc	        enable LIRC (remote control) support
+	--enable-lirc	        enable LIRC ( remote control ) support
+	
+	--disable-select        disable audio select() support ( for example required this
+	                        option ALSA or Vortex2 driver )
 
         --with-x11libdir=DIR    X library files are in DIR
         --with-win32libdir=DIR  windows codec files
@@ -130,16 +137,6 @@
 # ---  Check for C compiler:
 
 _cc=gcc
-_x11=auto
-
-_x11libdir=
-if [ -e /usr/X11R6 ]; then
- _x11libdir=-L/usr/X11R6/lib
-else
- if [ -e /usr/X11 ]; then
-  _x11libdir=-L/usr/X11/lib
- fi
-fi
 
 for ac_option
 do
@@ -147,15 +144,6 @@
   --cc=*)
         _cc=`echo $ac_option | cut -d '=' -f 2`
         ;;
-  --with-x11libdir=*)
-        _x11libdir=-L`echo $ac_option | cut -d '=' -f 2`
-        ;;
-  --enable-x11)
-        _x11=yes
-        ;;
-  --disable-x11)
-        _x11=no
-        ;;
  esac
 done
 
@@ -182,6 +170,7 @@
 _sdl=no
 _xv=no
 _vm=no
+_x11=no
 _3dfx=no
 _syncfb=no
 _mlib=no
@@ -190,7 +179,7 @@
 _dga=no
 _dga2=no
 _svga=no
-_fbdev=yes
+_fbdev=no
 _lirc=no
 _xdpms=no
 
@@ -199,8 +188,11 @@
 
 _gllib=
 _sdllib=
+_x11lib=
 _xvlib=
-_x11lib=
+_xlibdir=
+
+_select='#define HAVE_AUDIO_SELECT'
 
 for i in `echo $pparam`; do
 
@@ -237,6 +229,13 @@
 
 done
 
+if [ -e /usr/X11R6 ]; then
+ _x11libdir=-L/usr/X11R6/lib
+else
+ if [ -e /usr/X11 ]; then
+  _x11libdir=-L/usr/X11/lib
+ fi
+fi
 
 _win32libdirnotify=no
 if [ -e /usr/lib/win32 ]; then
@@ -376,15 +375,21 @@
 #echo "DONE (${proc})."
 
 
-$_cc $TMPC -o $TMPO -lvgagl -lvga &> /dev/null && _svga=yes
+# check GL & X11 & Xext & Xv & SDL & termcap libs
 
-$_cc $TMPC -o $TMPO -lpthread &> /dev/null || \
+$_cc $TMPC -o $TMPO $_x11libdir/ -lGL &> /dev/null && _gl=yes
+$_cc $TMPC -o $TMPO $_x11libdir/ -lXxf86vm &> /dev/null && _vm=yes
+$_cc $TMPC -o $TMPO -lvgagl -lvga &> /dev/null && _svga=yes
+$_cc $TMPC -o $TMPO $_x11libdir -lX11 -lXext &> /dev/null && _x11=yes
+$_cc $TMPC -o $TMPO $_x11libdir -lX11 -lXext -lXdpms &> /dev/null && _xdpms=yes
+$_cc $TMPC -o $TMPO $_x11libdir -lXv &> /dev/null && _xv=yes
+$_cc $TMPC -o $TMPO $_x11libdir -L/usr/local/lib/ -lpthread &> /dev/null || \
  { echo "Lib pthread not found."; rm -f $TMPC $TMPO ; exit 1; }
 
 # SDL disabled by default (0.11pre22-) because of the compilation problems
 # this is very buggy & experimental code, use it only if you really need it!!
 _have_sdl=no
-$_cc $TMPC -o $TMPO -L/usr/local/lib/ -lSDL -lpthread &> /dev/null && _have_sdl=yes
+$_cc $TMPC -o $TMPO $_x11libdir -L/usr/local/lib/ -lSDL -lpthread &> /dev/null && _have_sdl=yes
 
 _termcap=no
 $_cc $TMPC -o $TMPO -ltermcap &> /dev/null && _termcap=yes
@@ -392,28 +397,7 @@
 _binutils=no
 as libac3/downmix/downmix_i386.S -o $TMPO &> /dev/null && _binutils=yes
 
-# ----------- Check X11 and related libs (GL, Xxf86vm, Xv, DGA) --------------
-
-if [ $_x11 = auto ]; then
-  _x11=no
-  $_cc $TMPC -o $TMPO $_x11libdir -lX11 -lXext &> /dev/null && _x11=yes
-fi
-
-if [ $_x11 = yes ]; then
-
-$_cc $TMPC -o $TMPO $_x11libdir -lX11 -lXext -lXdpms &> /dev/null && _xdpms=yes
-$_cc $TMPC -o $TMPO $_x11libdir -lXv &> /dev/null && _xv=yes
-
-$_cc $TMPC -o $TMPO $_x11libdir -lGL &> /dev/null && _gl=yes
-
-cat > $TMPC << EOF
-#include <GL/gl.h>
-int main( void ) { return 0; }
-EOF
-$_cc $TMPC -o $TMPO $_x11libdir -lGL &> /dev/null || \
- { _gl=no; echo "GL includes not found!";}
-
-$_cc $TMPC -o $TMPO $_x11libdir -lXxf86vm &> /dev/null && _vm=yes
+# LGB: Check DGA
 
 cat > $TMPC << EOF
 #include <stdio.h>
@@ -422,6 +406,7 @@
 int main (void) { return 0;}
 EOF
 
+_dga=no
 $_cc $TMPC -o $TMPO -L/usr/X11R6/lib -L/usr/X11/lib -lX11 -lXext -lXxf86dga -lXxf86vm &> /dev/null && _dga=yes
 # Note: the -lXxf86vm library is the VideoMode extension and though it's
 # not needed for DGA, AFAIK every distribution packages together with DGA
@@ -429,6 +414,8 @@
 # for further mplayer versions to set resolution by mplayer itself.
 # If you run into problems, remove '-lXxf86vm'.
 
+# ---
+
 # Check if DGA is 2.0 or greater
 cat > $TMPC << EOF
 #include <stdio.h>
@@ -440,10 +427,24 @@
 _dga2=no
 $_cc $TMPC -o $TMPO -L/usr/X11R6/lib -L/usr/X11/lib -lX11 -lXext -lXxf86dga -lXxf86vm &> /dev/null && _dga2=yes
 
-fi
+
+cat > $TMPC << EOF
+#include <GL/gl.h>
+int main( void ) { return 0; }
+EOF
+
+$_cc $TMPC -o $TMPO $_x11libdir/ -lGL &> /dev/null || \
+ { _gl=no; echo "GL includes not found!";}
 
 rm -f $TMPC $TMPO
 
+
+if [ $_x11 = 'yes' ]; then
+ if [ $_mga = 'yes' ]; then
+  _xmga=yes
+ fi
+fi
+
 # ---
 
 # check for the parameters.
@@ -493,6 +494,9 @@
   --enable-vm)
         _vm=yes
         ;;
+  --enable-x11)
+        _x11=yes
+        ;;
   --enable-3dfx)
         _3dfx=yes
         ;;
@@ -514,6 +518,9 @@
   --enable-lirc)
 	_lirc=yes
 	;;
+  --enable-select)
+        _select='#define HAVE_AUDIO_SELECT'
+	;;
   --disable-sse)
         _sse=no
         ;;
@@ -545,6 +552,9 @@
   --disable-vm)
         _vm=no
         ;;
+  --disable-x11)
+        _x11=no
+        ;;
   --disable-mlib)
 	_mlib=no
 	;;
@@ -563,6 +573,12 @@
   --disable-termcap)
 	_termcap=no
 	;;
+  --disable-select)
+        _select='#undef HAVE_AUDIO_SELECT'
+	;;
+  --with-x11libdir=*)
+        _x11libdir=-L`echo $ac_option | cut -d '=' -f 2`
+        ;;
   --with-win32libdir=*)
         _win32libdir=`echo $ac_option | cut -d '=' -f 2`
 	_win32libdirnotify=no
@@ -573,19 +589,11 @@
   --size-y=*)
 	_y=`echo $ac_option | cut -d '=' -f 2`
 	;;
-  --with-x11libdir=*)
-        ;;
   --cc=*)
 	;;
  esac
 done
 
-if [ $_x11 = 'yes' ]; then
- if [ $_mga = 'yes' ]; then
-  _xmga=yes
- fi
-fi
-
 # to screen.
 echo "Using C compiler: $_cc"
 echo "Checking for cpu vendor ... $pvendor ( $pfamily:$pmodel:$pstepping )"
@@ -675,10 +683,12 @@
 
 AR=ar
 CC=$_cc
+X11DIR=$_x11libdir
 # OPTFLAGS=-O4 -march=$proc -mcpu=$proc -pipe -fomit-frame-pointer -ffast-math
 OPTFLAGS=-O4 -march=$proc -mcpu=$proc -pipe -ffast-math
 # LIBS=-L/usr/lib -L/usr/local/lib $_x11libdir $_gllib $_sdllib $_dgalib $_x11lib $_xvlib
-X_LIBS=$_x11libdir $_gllib $_sdllib $_dgalib $_x11lib $_xvlib $_vmlib $_svgalib
+# X_LIBS=$_x11libdir $_gllib $_sdllib $_dgalib $_x11lib $_xvlib $_vmlib $_svgalib
+X_LIBS=\$(X11DIR) $_gllib $_sdllib $_dgalib $_x11lib $_xvlib $_vmlib $_svgalib
 TERMCAP_LIB=$_libtermcap
 XMM_LIBS = $_xmmplibs
 LIRC_LIBS = $_lirclibs
@@ -837,7 +847,7 @@
 /* Undefine this if your soundcard driver has no working select().
    If you have kernel Oops, player hangups, or just no audio, you should
    try to recompile MPlayer with this option disabled! */
-#define HAVE_AUDIO_SELECT
+$_select
 
 /* You have a choice for MP3 decoding: mp3lib(mpg123) or Win32(l3codeca.acm)
    #define this if you prefer mpg123 (with 3Dnow! support) than l3codeca.acm
--- a/help_mp.h	Sun Apr 15 18:27:51 2001 +0000
+++ b/help_mp.h	Sun Apr 15 18:35:17 2001 +0000
@@ -1,10 +1,10 @@
 static char* banner_text=
 "\n\n"
-"MPlayer " VERSION "  (C) 2000-2001 Arpad Gereoffy <arpi@thot.banki.hu>\n"
+"MPlayer " VERSION "       (C) 2000-2001 Arpad Gereoffy <arpi@esp-team.scene.hu>\n"
 "\n";
 
 static char* help_text=
-"\nUsage:   mplayer [options] [path/]name\n"
+"Usage:   mplayer [options] [path/]name\n"
 "\n"
 "  Options:\n"
 "    -vo <driver>    select output driver (see '-vo help' for driver list)\n"
@@ -40,4 +40,6 @@
 "    q or ESC        stop playing and quit program\n"
 "    + or -          adjust audio delay by +/- 0.1 second\n"
 "    o               toggle OSD:  none / seek / seek+timer\n"
+"    * or /          increase or decrease volume\n"
+"    m or c          use mixer master or pcm channel\n"
 "\n";
--- a/libvo/wskeys.h	Sun Apr 15 18:27:51 2001 +0000
+++ b/libvo/wskeys.h	Sun Apr 15 18:35:17 2001 +0000
@@ -60,6 +60,8 @@
 #define wsSpace ' '
 #define wsMinus '-'
 #define wsPlus  '+'
+#define wsMul   '*'
+#define wsDiv   '/'
 
 #define wsUp            0x52 + 256
 #define wsDown          0x54 + 256
--- a/libvo/x11_common.c	Sun Apr 15 18:27:51 2001 +0000
+++ b/libvo/x11_common.c	Sun Apr 15 18:35:17 2001 +0000
@@ -1,41 +1,37 @@
-
 #include <stdio.h>
 #include <stdlib.h>
-
-#include "config.h"
+#include <string.h>
 
-#ifdef X11_FULLSCREEN
-
-#include <string.h>
 #include <unistd.h>
 #include <sys/mman.h>
 
+#include "config.h"
 #include "video_out.h"
 
+#ifdef X11_FULLSCREEN
+
 #include <X11/Xmd.h>
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
 #include <X11/Xatom.h>
 
-#include <X11/extensions/dpms.h>
-
 static int dpms_disabled=0;
 static int timeout_save=0;
 
 
 void vo_hidecursor ( Display *disp , Window win )
 {
-	Cursor no_ptr;
-	Pixmap bm_no;
-	XColor black,dummy;
-	Colormap colormap;
-	static unsigned char bm_no_data[] = { 0,0,0,0, 0,0,0,0  };
-	
-	colormap = DefaultColormap(disp,DefaultScreen(disp));
-	XAllocNamedColor(disp,colormap,"black",&black,&dummy);	
-	bm_no = XCreateBitmapFromData(disp, win, bm_no_data, 8,8);    
-	no_ptr=XCreatePixmapCursor(disp, bm_no, bm_no,&black, &black,0, 0);									          
-	XDefineCursor(disp,win,no_ptr);
+        Cursor no_ptr;
+        Pixmap bm_no;
+        XColor black,dummy;
+        Colormap colormap;
+        static unsigned char bm_no_data[] = { 0,0,0,0, 0,0,0,0  };
+
+        colormap = DefaultColormap(disp,DefaultScreen(disp));
+        XAllocNamedColor(disp,colormap,"black",&black,&dummy);
+        bm_no = XCreateBitmapFromData(disp, win, bm_no_data, 8,8);
+        no_ptr=XCreatePixmapCursor(disp, bm_no, bm_no,&black, &black,0, 0);
+        XDefineCursor(disp,win,no_ptr);
 }
 
 
@@ -100,6 +96,10 @@
    case wsGrayMinus: mplayer_put_key('-'); break;
    case wsPlus:
    case wsGrayPlus:  mplayer_put_key('+'); break;
+   case wsGrayMul:
+   case wsMul:       mplayer_put_key('*'); break;
+   case wsGrayDiv:
+   case wsDiv:       mplayer_put_key('/'); break;
    default: if((key>='a' && key<='z')||(key>='A' && key<='Z')) mplayer_put_key(key);
   }
 
@@ -153,17 +153,17 @@
    switch( Event.type )
     {
        case Expose:
-	     ret|=VO_EVENT_EXPOSE;
+             ret|=VO_EVENT_EXPOSE;
              break;
        case ConfigureNotify:
              vo_dwidth=Event.xconfigure.width;
-	     vo_dheight=Event.xconfigure.height;
-	     ret|=VO_EVENT_RESIZE;
+             vo_dheight=Event.xconfigure.height;
+             ret|=VO_EVENT_RESIZE;
              break;
        case KeyPress:
              XLookupString( &Event.xkey,buf,sizeof(buf),&keySym,&stat );
              vo_x11_putkey( ( (keySym&0xff00) != 0?( (keySym&0x00ff) + 256 ):( keySym ) ) );
-	     ret|=VO_EVENT_KEYPRESS;
+             ret|=VO_EVENT_KEYPRESS;
              break;
     }
   }
@@ -171,25 +171,27 @@
   return ret;
 }
 
+#endif
+
 void saver_on(Display *mDisplay) {
 
     int nothing;
     if (dpms_disabled)
     {
-	if (DPMSQueryExtension(mDisplay, &nothing, &nothing))
-	{
-	    printf ("Enabling DPMS\n");
-	    DPMSEnable(mDisplay);  // restoring power saving settings
-	    DPMSQueryExtension(mDisplay, &nothing, &nothing);
-	}
+        if (DPMSQueryExtension(mDisplay, &nothing, &nothing))
+        {
+            printf ("Enabling DPMS\n");
+            DPMSEnable(mDisplay);  // restoring power saving settings
+            DPMSQueryExtension(mDisplay, &nothing, &nothing);
+        }
     }
-    
+
     if (timeout_save)
     {
-	int dummy, interval, prefer_blank, allow_exp;
-	XGetScreenSaver(mDisplay, &dummy, &interval, &prefer_blank, &allow_exp);
-	XSetScreenSaver(mDisplay, timeout_save, interval, prefer_blank, allow_exp);
-	XGetScreenSaver(mDisplay, &timeout_save, &interval, &prefer_blank, &allow_exp);
+        int dummy, interval, prefer_blank, allow_exp;
+        XGetScreenSaver(mDisplay, &dummy, &interval, &prefer_blank, &allow_exp);
+        XSetScreenSaver(mDisplay, timeout_save, interval, prefer_blank, allow_exp);
+        XGetScreenSaver(mDisplay, &timeout_save, &interval, &prefer_blank, &allow_exp);
     }
 
 }
@@ -200,20 +202,18 @@
 
     if (DPMSQueryExtension(mDisplay, &nothing, &nothing))
     {
-	BOOL onoff;
-	CARD16 state;
-	DPMSInfo(mDisplay, &state, &onoff);
-	if (onoff)
-	{
-	    printf ("Disabling DPMS\n");
-	    dpms_disabled=1;
-		DPMSDisable(mDisplay);  // monitor powersave off
-	}
+        BOOL onoff;
+        CARD16 state;
+        DPMSInfo(mDisplay, &state, &onoff);
+        if (onoff)
+        {
+            printf ("Disabling DPMS\n");
+            dpms_disabled=1;
+                DPMSDisable(mDisplay);  // monitor powersave off
+        }
     }
     XGetScreenSaver(mDisplay, &timeout_save, &interval, &prefer_blank, &allow_exp);
     if (timeout_save)
-	XSetScreenSaver(mDisplay, 0, interval, prefer_blank, allow_exp);
-		    // turning off screensaver
+        XSetScreenSaver(mDisplay, 0, interval, prefer_blank, allow_exp);
+                    // turning off screensaver
 }
-
-#endif
--- a/lirc_mp.c	Sun Apr 15 18:27:51 2001 +0000
+++ b/lirc_mp.c	Sun Apr 15 18:35:17 2001 +0000
@@ -95,7 +95,11 @@
     {"FFWD" , KEY_UP},
     {"RWND" , KEY_LEFT},
     {"FRWND" , KEY_DOWN},
-    {"PAUSE", 'p'}    
+    {"PAUSE", 'p'},
+    {"INCVOL", '*'},
+    {"DECVOL", '/'},
+    {"MASTER", 'm'},
+    {"PCM", 'c'}
   };
        
   char *code;
--- a/mplayer.c	Sun Apr 15 18:27:51 2001 +0000
+++ b/mplayer.c	Sun Apr 15 18:35:17 2001 +0000
@@ -88,7 +88,7 @@
 #define ABS(x) (((x)>=0)?(x):(-(x)))
 
 //**************************************************************************//
-//             .SUB 
+//             .SUB
 //**************************************************************************//
 
 static current_sub=0;
@@ -127,47 +127,39 @@
 }
 
 static int cfg_include(struct config *conf, char *filename){
-	return parse_config_file(conf, filename);
+        return parse_config_file(conf, filename);
 }
 
 char *get_path(char *filename){
-	char *homedir;
-	char *buff;
-	static char *config_dir = "/.mplayer";
-	int len;
+        char *homedir;
+        char *buff;
+        static char *config_dir = "/.mplayer";
+        int len;
 
-	if ((homedir = getenv("HOME")) == NULL)
-		return NULL;
-	len = strlen(homedir) + strlen(config_dir) + 1;
-	if (filename == NULL) {
-		if ((buff = (char *) malloc(len)) == NULL)
-			return NULL;
-		sprintf(buff, "%s%s", homedir, config_dir);
-	} else {
-		len += strlen(filename) + 1;
-		if ((buff = (char *) malloc(len)) == NULL)
-			return NULL;
-		sprintf(buff, "%s%s/%s", homedir, config_dir, filename);
-	}
-	return buff;
+        if ((homedir = getenv("HOME")) == NULL)
+                return NULL;
+        len = strlen(homedir) + strlen(config_dir) + 1;
+        if (filename == NULL) {
+                if ((buff = (char *) malloc(len)) == NULL)
+                        return NULL;
+                sprintf(buff, "%s%s", homedir, config_dir);
+        } else {
+                len += strlen(filename) + 1;
+                if ((buff = (char *) malloc(len)) == NULL)
+                        return NULL;
+                sprintf(buff, "%s%s/%s", homedir, config_dir, filename);
+        }
+        return buff;
 }
 
 static int max_framesize=0;
 
-//static int dbg_es_sent=0;
-//static int dbg_es_rcvd=0;
+static int dbg_es_sent=0;
+static int dbg_es_rcvd=0;
 
 //static int show_packets=0;
 
 //**************************************************************************//
-//**************************************************************************//
-//             Input media streaming & demultiplexer:
-//**************************************************************************//
-
-#include "stream.c"
-#include "demuxer.c"
-
-#include "stheader.h"
 
 typedef struct {
   // file:
@@ -181,9 +173,6 @@
   int idx_pos_a;
   int idx_pos_v;
   int idx_offset;  // ennyit kell hozzaadni az index offset ertekekhez
-  // streams:
-  sh_audio_t* a_streams[256];
-  sh_video_t* v_streams[256];
   // video:
   unsigned int bitrate;
 } avi_header_t;
@@ -192,28 +181,20 @@
 
 #include "aviprint.c"
 
-sh_audio_t* new_sh_audio(int id){
-    if(avi_header.a_streams[id]){
-        printf("Warning! Audio stream header %d redefined!\n",id);
-    } else {
-        if(verbose) printf("Found audio stream: %d\n",id);
-        avi_header.a_streams[id]=malloc(sizeof(sh_audio_t));
-        memset(avi_header.a_streams[id],0,sizeof(sh_audio_t));
-    }
-    return avi_header.a_streams[id];
-}
+extern picture_t *picture;
+
+char* encode_name=NULL;
+char* encode_index_name=NULL;
+int encode_bitrate=0;
 
-sh_video_t* new_sh_video(int id){
-    if(avi_header.v_streams[id]){
-        printf("Warning! video stream header %d redefined!\n",id);
-    } else {
-        if(verbose) printf("Found video stream: %d\n",id);
-        avi_header.v_streams[id]=malloc(sizeof(sh_video_t));
-        memset(avi_header.v_streams[id],0,sizeof(sh_video_t));
-    }
-    return avi_header.v_streams[id];
-}
+//**************************************************************************//
+//             Input media streaming & demultiplexer:
+//**************************************************************************//
 
+#include "stream.c"
+#include "demuxer.c"
+
+#include "stheader.h"
 
 #include "demux_avi.c"
 #include "demux_mpg.c"
@@ -222,18 +203,14 @@
 demux_stream_t *d_audio=NULL;
 demux_stream_t *d_video=NULL;
 
-sh_audio_t *sh_audio=NULL;//&sh_audio_i;
-sh_video_t *sh_video=NULL;//&sh_video_i;
-
-char* encode_name=NULL;
-char* encode_index_name=NULL;
-int encode_bitrate=0;
+sh_audio_t sh_audio_i; // FIXME later!
+sh_video_t sh_video_i;
+sh_audio_t *sh_audio=&sh_audio_i;
+sh_video_t *sh_video=&sh_video_i;
 
 // MPEG video stream parser:
 #include "parse_es.c"
 
-extern picture_t *picture;
-
 static const int frameratecode2framerate[16] = {
    0, 24000*10000/1001, 24*10000,25*10000, 30000*10000/1001, 30*10000,50*10000,60000*10000/1001,
   60*10000, 0,0,0,0,0,0,0
@@ -274,15 +251,15 @@
 
 // callback, the opendivx decoder calls this for each frame:
 void convert_linux(unsigned char *puc_y, int stride_y,
-	unsigned char *puc_u, unsigned char *puc_v, int stride_uv,
-	unsigned char *bmp, int width_y, int height_y){
+        unsigned char *puc_u, unsigned char *puc_v, int stride_uv,
+        unsigned char *bmp, int width_y, int height_y){
 
 //    printf("convert_yuv called  %dx%d  stride: %d,%d\n",width_y,height_y,stride_y,stride_uv);
 
     opendivx_src[0]=puc_y;
     opendivx_src[1]=puc_u;
     opendivx_src[2]=puc_v;
-    
+
     opendivx_stride[0]=stride_y;
     opendivx_stride[1]=stride_uv;
     opendivx_stride[2]=stride_uv;
@@ -372,7 +349,6 @@
 }
 
 int divx_quality=0;
-extern int vo_dbpp;
 
 int main(int argc,char* argv[], char *envp[]){
 char* filename=NULL; //"MI2-Trailer.avi";
@@ -383,8 +359,8 @@
 int stream_type;
 stream_t* stream=NULL;
 int file_format=DEMUXER_TYPE_UNKNOWN;
-int has_audio=1;
-//int has_video=1;
+int has_audio=1; // audio  0=no 1=mpeg 2=pcm 3=ac3 4=ACM 5=alaw 6=msgsm 7=DShow
+int has_video=1; // video  0=no 1=mpeg 2=win32/VfW 3=OpenDivX 4=w32/DShow
 //
 int audio_format=0; // override
 #ifdef ALSA_TIMER
@@ -430,7 +406,10 @@
 float sub_delay=0;
 float sub_fps=0;
 //int user_bpp=0;
-
+extern int vo_dbpp;
+// --- NEW
+#include "mixer.h"
+// ---
 #include "cfg-mplayer.h"
 
   printf("%s",banner_text);
@@ -470,40 +449,12 @@
   i=0;
   while (video_out_drivers[i]) {
     const vo_info_t *info = video_out_drivers[i++]->get_info ();
-  	printf("\t%s\t%s\n", info->short_name, info->name);
+        printf("\t%s\t%s\n", info->short_name, info->name);
   }
   printf("\n");
   exit(0);
 }
 
-if(!filename){
-  if(vcd_track) filename="/dev/cdrom"; 
-  else {
-    printf("%s",help_text); exit(0);
-  }
-}
-
-// check video_out driver name:
-  if(!video_driver)
-    video_out=video_out_drivers[0];
-  else
-  for (i=0; video_out_drivers[i] != NULL; i++){
-    const vo_info_t *info = video_out_drivers[i]->get_info ();
-    if(strcmp(info->short_name,video_driver) == 0){
-      video_out = video_out_drivers[i];break;
-    }
-  }
-  if(!video_out){
-    printf("Invalid video output driver name: %s\n",video_driver);
-    return 0;
-  }
-
-// check codec.conf
-if(!parse_codec_cfg(get_path("codecs.conf"))){
-    printf("(copy/link DOCS/codecs.conf to ~/.mplayer/codecs.conf)\n");
-    exit(1);
-}
-
 // check font
   if(font_name){
        vo_font=read_font_desc(font_name,font_factor,verbose>1);
@@ -523,6 +474,35 @@
   }
 
 
+// check video_out driver name:
+  if(!video_driver)
+    video_out=video_out_drivers[0];
+  else
+  for (i=0; video_out_drivers[i] != NULL; i++){
+    const vo_info_t *info = video_out_drivers[i]->get_info ();
+    if(strcmp(info->short_name,video_driver) == 0){
+      video_out = video_out_drivers[i];break;
+    }
+  }
+  if(!video_out){
+    printf("Invalid video output driver name: %s\n",video_driver);
+    return 0;
+  }
+
+if(!filename){
+  if(vcd_track) filename="/dev/cdrom";
+  else {
+    printf("%s",help_text); exit(0);
+  }
+}
+
+// check codec.conf
+if(!parse_codec_cfg(get_path("codecs.conf"))){
+    printf("(copy/link DOCS/codecs.conf to ~/.mplayer/codecs.conf)\n");
+    exit(1);
+}
+
+
 if(vcd_track){
 //============ Open VideoCD track ==============
   f=open(filename,O_RDONLY);
@@ -546,7 +526,7 @@
 
 //============ Open & Sync stream and detect file format ===============
 
-if(!has_audio) audio_id=-2; // do NOT read audio packets...
+if(has_audio==0) audio_id=-2; // do NOT read audio packets...
 
 //=============== Try to open as AVI file: =================
 stream_reset(stream);
@@ -557,7 +537,7 @@
   if(id==mmioFOURCC('R','I','F','F')){
     stream_read_dword_le(demuxer->stream); //filesize
     id=stream_read_dword_le(demuxer->stream); // "AVI "
-    if(id==formtypeAVI){ 
+    if(id==formtypeAVI){
       printf("Detected AVI file format!\n");
       file_format=DEMUXER_TYPE_AVI;
     }
@@ -618,10 +598,8 @@
 //====== File format recognized, set up these for compatibility: =========
 d_audio=demuxer->audio;
 d_video=demuxer->video;
-//d_audio->sh=sh_audio; 
-//d_video->sh=sh_video; 
-//sh_audio=d_audio->sh;sh_audio->ds=d_audio;
-//sh_video=d_video->sh;sh_video->ds=d_video;
+d_audio->sh=sh_audio; sh_audio->ds=d_audio;
+d_video->sh=sh_video; sh_video->ds=d_video;
 
 switch(file_format){
  case DEMUXER_TYPE_AVI: {
@@ -641,7 +619,7 @@
     if(verbose) printf("AVI index offset: %d\n",avi_header.idx_offset);
   }
   demuxer->endpos=avi_header.movi_end;
-  
+
   if(avi_header.idx_size>0){
       // check that file is non-interleaved:
       int i;
@@ -671,7 +649,7 @@
         if(force_ni || abs(a_pos-v_pos)>0x100000){  // distance > 1MB
           printf("Detected NON-INTERLEAVED AVI file-format!\n");
           demuxer->type=DEMUXER_TYPE_AVI_NI; // HACK!!!!
-	  pts_from_bps=1; // force BPS sync!
+          pts_from_bps=1; // force BPS sync!
         }
       }
   } else {
@@ -679,26 +657,21 @@
       if(force_ni){
           printf("Using NON-INTERLEAVED Broken AVI file-format!\n");
           demuxer->type=DEMUXER_TYPE_AVI_NINI; // HACK!!!!
-	  avi_header.idx_pos_a=
-	  avi_header.idx_pos_v=avi_header.movi_start;
-	  pts_from_bps=1; // force BPS sync!
+          avi_header.idx_pos_a=
+          avi_header.idx_pos_v=avi_header.movi_start;
+          pts_from_bps=1; // force BPS sync!
       }
   }
   if(!ds_fill_buffer(d_video)){
     printf("AVI: missing video stream!? contact the author, it may be a bug :(\n");
     exit(1);
   }
-  sh_video=d_video->sh;sh_video->ds=d_video;
   if(has_audio){
-    if(verbose) printf("AVI: Searching for audio stream (id:%d)\n",d_audio->id);
+    if(verbose) printf("ASF: Searching for audio stream (id:%d)\n",d_audio->id);
     if(!ds_fill_buffer(d_audio)){
-      printf("AVI: No Audio stream found...  ->nosound\n");
+      printf("ASF: No Audio stream found...  ->nosound\n");
       has_audio=0;
-      sh_audio=NULL;
-    } else {
-      sh_audio=d_audio->sh;sh_audio->ds=d_audio;
-      sh_audio->format=sh_audio->wf->wFormatTag;
-    }
+    } else sh_audio->format=sh_audio->wf.wFormatTag;
   }
   // calc. FPS:
   sh_video->fps=(float)sh_video->video.dwRate/(float)sh_video->video.dwScale;
@@ -709,10 +682,10 @@
   if(verbose) printf("AVI video length=%d\n",avi_header.bitrate);
   avi_header.bitrate=((float)avi_header.bitrate/(float)sh_video->video.dwLength)*sh_video->fps;
   printf("VIDEO:  [%.4s]  %dx%d  %dbpp  %4.2f fps  %5.1f kbps (%4.1f kbyte/s)\n",
-    &sh_video->bih->biCompression,
-    sh_video->bih->biWidth,
-    sh_video->bih->biHeight,
-    sh_video->bih->biBitCount,
+    &sh_video->bih.biCompression,
+    sh_video->bih.biWidth,
+    sh_video->bih.biHeight,
+    sh_video->bih.biBitCount,
     sh_video->fps,
     avi_header.bitrate*0.008f,
     avi_header.bitrate/1024.0f );
@@ -729,42 +702,36 @@
     printf("ASF: missing video stream!? contact the author, it may be a bug :(\n");
     exit(1);
   }
-  sh_video=d_video->sh;sh_video->ds=d_video;
   if(has_audio){
     if(verbose) printf("ASF: Searching for audio stream (id:%d)\n",d_audio->id);
     if(!ds_fill_buffer(d_audio)){
       printf("ASF: No Audio stream found...  ->nosound\n");
       has_audio=0;
-      sh_audio=NULL;
-    } else {
-      sh_audio=d_audio->sh;sh_audio->ds=d_audio;
-      sh_audio->format=sh_audio->wf->wFormatTag;
-    }
+    } else sh_audio->format=sh_audio->wf.wFormatTag;
   }
   sh_video->fps=1000.0f; sh_video->frametime=0.001f; // 1ms
   printf("VIDEO:  [%.4s]  %dx%d  %dbpp\n",
-    &sh_video->bih->biCompression,
-    sh_video->bih->biWidth,
-    sh_video->bih->biHeight,
-    sh_video->bih->biBitCount);
+    &sh_video->bih.biCompression,
+    sh_video->bih.biWidth,
+    sh_video->bih.biHeight,
+    sh_video->bih.biBitCount);
   break;
  }
  case DEMUXER_TYPE_MPEG_ES: {
-   d_audio->type=0;
-   has_audio=0;sh_audio=NULL; // ES streams has no audio channel
+   demuxer->audio->type=0;
+   has_audio=0; // ES streams has no audio channel
    break;
  }
  case DEMUXER_TYPE_MPEG_PS: {
   if(has_audio)
   if(!ds_fill_buffer(d_audio)){
     printf("MPEG: No Audio stream found...  ->nosound\n");
-    has_audio=0;sh_audio=NULL;
+    has_audio=0;
   } else {
-    sh_audio=d_audio->sh;sh_audio->ds=d_audio;
     if(verbose) printf("detected MPG-PS audio format: %d\n",d_audio->type);
     switch(d_audio->type){
       case 1: sh_audio->format=0x50;break; // mpeg
-      case 2: sh_audio->format=0x10001;break;  // dvd pcm
+      case 2: sh_audio->format=0x2;break;  // pcm
       case 3: sh_audio->format=0x2000;break; // ac3
       default: has_audio=0; // unknown type
     }
@@ -778,9 +745,9 @@
  case DEMUXER_TYPE_AVI:
  case DEMUXER_TYPE_ASF: {
   // display info:
-  sh_video->format=sh_video->bih->biCompression;
-  sh_video->disp_w=sh_video->bih->biWidth;
-  sh_video->disp_h=abs(sh_video->bih->biHeight);
+  sh_video->format=sh_video->bih.biCompression;
+  sh_video->disp_w=sh_video->bih.biWidth;
+  sh_video->disp_h=abs(sh_video->bih.biHeight);
   break;
  }
  case DEMUXER_TYPE_MPEG_ES:
@@ -797,7 +764,6 @@
       }
    }
    if(verbose) printf("OK!\n");
-   sh_video=d_video->sh;sh_video->ds=d_video;
    sh_video->format=1; // mpeg video
    mpeg2_init();
    // ========= Read & process sequence header & extension ============
@@ -833,7 +799,7 @@
  }
 } // switch(file_format)
 
-//if(verbose) printf("file successfully opened  (has_audio=%d)\n",has_audio);
+if(verbose) printf("file successfully opened  (has_audio=%d)\n",has_audio);
 
 printf("[V] filefmt:%d  fourcc:0x%X  size:%dx%d  fps:%5.2f  ftime:=%6.4f\n",
    file_format,sh_video->format,sh_video->disp_w,sh_video->disp_h,
@@ -851,15 +817,15 @@
     has_audio=0;
   } else {
     printf("Found audio codec: [%s] drv:%d (%s)\n",sh_audio->codec->name,sh_audio->codec->driver,sh_audio->codec->info);
-    //has_audio=sh_audio->codec->driver;
+    has_audio=sh_audio->codec->driver;
   }
 }
 
 if(has_audio){
   if(verbose) printf("Initializing audio codec...\n");
-  if(!init_audio(sh_audio)){
+  has_audio=init_audio(sh_audio);
+  if(!has_audio){
     printf("Couldn't initialize audio codec! -> nosound\n");
-    has_audio=0;
   } else {
     printf("AUDIO: samplerate=%d  channels=%d  bps=%d\n",sh_audio->samplerate,sh_audio->channels,sh_audio->samplesize);
   }
@@ -868,19 +834,26 @@
 //================== Init VIDEO (codec & libvo) ==========================
 
 // Go through the codec.conf and find the best codec...
-sh_video->codec=find_codec(sh_video->format,
-    sh_video->bih?((unsigned int*) &sh_video->bih->biCompression):NULL,NULL,0);
+sh_video->codec=find_codec(sh_video->format,(unsigned int*) &sh_video->bih.biCompression,NULL,0);
 if(!sh_video->codec){
     printf("Can't find codec for video format 0x%X !\n",sh_video->format);
     exit(1);
 }
-//has_video=sh_video->codec->driver;
+has_video=sh_video->codec->driver;
 
 printf("Found video codec: [%s] drv:%d (%s)\n",sh_video->codec->name,sh_video->codec->driver,sh_video->codec->info);
 
+//if(user_bpp)printf("Trying user defined depth of %dbpp\n", user_bpp);
+
 for(i=0;i<CODECS_MAX_OUTFMT;i++){
     out_fmt=sh_video->codec->outfmt[i];
-    if(video_out->query_format(out_fmt)) break;
+//    if(vo_dbpp){
+//        if( ((out_fmt & IMGFMT_BGR_MASK) == IMGFMT_BGR) && ((out_fmt & 0xff) == vo_dbpp) || (out_fmt & IMGFMT_BGR_MASK) != IMGFMT_BGR){
+//           if(video_out->query_format(out_fmt)) break;
+//      }
+//    }else{
+          if(video_out->query_format(out_fmt)) break;
+//    }
 }
 if(i>=CODECS_MAX_OUTFMT){
     printf("Sorry, selected video_out device is incompatible with this codec.\n");
@@ -888,7 +861,7 @@
 }
 sh_video->outfmtidx=i;
 
-switch(sh_video->codec->driver){
+switch(has_video){
  case 2: {
    if(!init_video_codec(out_fmt)) exit(1);
    if(verbose) printf("INFO: Win32 video codec init OK!\n");
@@ -900,14 +873,14 @@
    exit(1);
 #else
    sh_video->our_out_buffer=NULL;
-   if(DS_VideoDecoder_Open(sh_video->codec->dll,&sh_video->codec->guid, sh_video->bih, 0, &sh_video->our_out_buffer)){
+   if(DS_VideoDecoder_Open(sh_video->codec->dll,&sh_video->codec->guid, &sh_video->bih, 0, &sh_video->our_out_buffer)){
         printf("ERROR: Couldn't open required DirectShow codec: %s\n",sh_video->codec->dll);
         printf("Maybe you forget to upgrade your win32 codecs?? It's time to download the new\n");
         printf("package from:  ftp://thot.banki.hu/esp-team/linux/MPlayer/w32codec.zip  !\n");
         printf("Or you should disable DShow support: make distclean;make -f Makefile.No-DS\n");
         exit(1);
    }
-   
+
    if(out_fmt==IMGFMT_YUY2)
      DS_VideoDecoder_SetDestFmt(16,mmioFOURCC('Y', 'U', 'Y', '2'));
 //     DS_VideoDecoder_SetDestFmt(16,mmioFOURCC('Y', 'V', '1', '2'));
@@ -918,7 +891,7 @@
 
    printf("DivX setting result = %d\n", DS_SetAttr_DivX("Quality",divx_quality) );
 //   printf("DivX setting result = %d\n", DS_SetValue_DivX("Brightness",60) );
-   
+
    if(verbose) printf("INFO: Win32/DShow video codec init OK!\n");
    break;
 #endif
@@ -927,12 +900,12 @@
    if(verbose) printf("OpenDivX video codec\n");
    { DEC_PARAM dec_param;
      DEC_SET dec_set;
-	dec_param.x_dim = sh_video->bih->biWidth;
-	dec_param.y_dim = sh_video->bih->biHeight;
-	dec_param.color_depth = 32;
-	decore(0x123, DEC_OPT_INIT, &dec_param, NULL);
-	dec_set.postproc_level = divx_quality;
-	decore(0x123, DEC_OPT_SETPP, &dec_set, NULL);
+        dec_param.x_dim = sh_video->bih.biWidth;
+        dec_param.y_dim = sh_video->bih.biHeight;
+        dec_param.color_depth = 32;
+        decore(0x123, DEC_OPT_INIT, &dec_param, NULL);
+        dec_set.postproc_level = divx_quality;
+        decore(0x123, DEC_OPT_SETPP, &dec_set, NULL);
    }
    if(verbose) printf("INFO: OpenDivX video codec init OK!\n");
    break;
@@ -1043,7 +1016,7 @@
    if(verbose) printf("INFO: Video OUT driver init OK!\n");
 
    fflush(stdout);
-   
+
 //================== MAIN: ==========================
 {
 int audio_fd=-1;
@@ -1171,10 +1144,9 @@
   if(verbose) printf("Freeing %d unused audio chunks\n",d_audio->packs);
   ds_free_packs(d_audio); // free buffered chunks
   d_audio->id=-2;         // do not read audio chunks
-  if(sh_audio) if(sh_audio->a_buffer) free(sh_audio->a_buffer);
+  if(sh_audio->a_buffer) free(sh_audio->a_buffer);
   alsa=1;
   // fake, required for timer:
-  sh_audio=new_sh_audio(255); // FIXME!!!!!!!!!!
   sh_audio->samplerate=76800;
   sh_audio->samplesize=sh_audio->channels=2;
   sh_audio->o_bps=sh_audio->channels*sh_audio->samplerate*sh_audio->samplesize;
@@ -1215,7 +1187,7 @@
   // Update buffer if needed
   unsigned int t=GetTimer();
   current_module="decode_audio";   // Enter AUDIO decoder module
-  //sh_audio->codec->driver=has_audio; // FIXME!
+  sh_audio->codec->driver=has_audio; // FIXME!
   while(sh_audio->a_buffer_len<OUTBURST && !d_audio->eof){
     int ret=decode_audio(sh_audio,&sh_audio->a_buffer[sh_audio->a_buffer_len],sh_audio->a_buffer_size-sh_audio->a_buffer_len);
     if(ret>0) sh_audio->a_buffer_len+=ret; else break;
@@ -1292,14 +1264,14 @@
 
 if(1)
   while(v_frame<a_frame || force_redraw){
-  
+
     float frame_time=1;
     float pts1=d_video->pts;
 
     current_module="decode_video";
 
   //--------------------  Decode a frame: -----------------------
-switch(sh_video->codec->driver){
+switch(has_video){
   case 3: {
     // OpenDivX
     unsigned int t=GetTimer();
@@ -1311,9 +1283,9 @@
     if(in_size>max_framesize) max_framesize=in_size;
     // let's decode
         dec_frame.length = in_size;
-	dec_frame.bitstream = start;
-	dec_frame.render_flag = 1;
-	decore(0x123, 0, &dec_frame, NULL);
+        dec_frame.bitstream = start;
+        dec_frame.render_flag = 1;
+        decore(0x123, 0, &dec_frame, NULL);
       t2=GetTimer();t=t2-t;video_time_usage+=t*0.000001f;
 
       if(opendivx_src[0]){
@@ -1349,15 +1321,14 @@
     int in_size=ds_get_packet(d_video,&start);
     if(in_size<0){ eof=1;break;}
     if(in_size>max_framesize) max_framesize=in_size;
-    
-    if(in_size){
-      sh_video->bih->biSizeImage = in_size;
-//      ret = ICDecompress(avi_header.hic, ICDECOMPRESS_NOTKEYFRAME|(ICDECOMPRESS_HURRYUP|ICDECOMPRESS_PREROL), 
-      ret = ICDecompress(sh_video->hic, ICDECOMPRESS_NOTKEYFRAME, 
-                         sh_video->bih,   start,
+
+      sh_video->bih.biSizeImage = in_size;
+//      ret = ICDecompress(avi_header.hic, ICDECOMPRESS_NOTKEYFRAME|(ICDECOMPRESS_HURRYUP|ICDECOMPRESS_PREROL),
+      ret = ICDecompress(sh_video->hic, ICDECOMPRESS_NOTKEYFRAME,
+                        &sh_video->bih,   start,
                         &sh_video->o_bih, sh_video->our_out_buffer);
       if(ret){ printf("Error decompressing frame, err=%d\n",ret);break; }
-    }
+
       t2=GetTimer();t=t2-t;video_time_usage+=t*0.000001f;
         video_out->draw_frame((uint8_t **)&sh_video->our_out_buffer);
       t2=GetTimer()-t2;vout_time_usage+=t2*0.000001f;
@@ -1389,30 +1360,30 @@
             if(i>=0x101 && i<0x1B0) in_frame=1; // picture startcode
             else if(!i){ eof=1; break;} // EOF
           }
-	  if(grab_frames==2 && (i==0x1B3 || i==0x1B8)) grab_frames=1;
+          if(grab_frames==2 && (i==0x1B3 || i==0x1B8)) grab_frames=1;
           if(!read_video_packet(d_video)){ eof=1; break;} // EOF
           //printf("read packet 0x%X, len=%d\n",i,videobuf_len);
         }
-        
+
         if(videobuf_len>max_framesize) max_framesize=videobuf_len; // debug
         //printf("--- SEND %d bytes\n",videobuf_len);
-	if(grab_frames==1){
-	      FILE *f=fopen("grab.mpg","ab");
-	      fwrite(videobuffer,videobuf_len-4,1,f);
-	      fclose(f);
-	}
-        
+        if(grab_frames==1){
+              FILE *f=fopen("grab.mpg","ab");
+              fwrite(videobuffer,videobuf_len-4,1,f);
+              fclose(f);
+        }
+
         t-=GetTimer();
           mpeg2_decode_data(video_out, videobuffer, videobuffer+videobuf_len);
         t+=GetTimer(); video_time_usage+=t*0.000001;
 
         newfps=frameratecode2framerate[picture->frame_rate_code]*0.0001f;
-        if(ABS(sh_video->fps-newfps)>0.01f) if(!force_fps){
+        if(ABS(sh_video->fps-newfps)>0.01f){
             printf("Warning! FPS changed %5.3f -> %5.3f  (%f) [%d]  \n",sh_video->fps,newfps,sh_video->fps-newfps,picture->frame_rate_code);
             sh_video->fps=newfps;
             sh_video->frametime=10000.0f/(float)frameratecode2framerate[picture->frame_rate_code];
         }
-        
+
         frame_time=(100+picture->repeat_count)*0.01f;
         picture->repeat_count=0;
 
@@ -1424,7 +1395,7 @@
     // Increase video timers:
     num_frames+=frame_time;
     frame_time*=sh_video->frametime;
-    if(file_format==DEMUXER_TYPE_ASF && !force_fps){
+    if(file_format==DEMUXER_TYPE_ASF){
         // .ASF files has no fixed FPS - just frame durations!
         float d=d_video->pts-pts1;
         if(d>=0 && d<5) frame_time=d;
@@ -1450,7 +1421,7 @@
   if(has_audio){
     if(pts_from_bps && (file_format==DEMUXER_TYPE_AVI)){
 //      a_pts=(float)ds_tell(d_audio)/sh_audio->wf.nAvgBytesPerSec-(buffer_delay+audio_delay);
-      a_pts=(float)ds_tell(d_audio)/sh_audio->wf->nAvgBytesPerSec-(buffer_delay);
+      a_pts=(float)ds_tell(d_audio)/sh_audio->wf.nAvgBytesPerSec-(buffer_delay);
       delay_corrected=1; // hack
     } else
     if(d_audio->pts){
@@ -1481,12 +1452,12 @@
         if(x> max_pts_correction) x= max_pts_correction;
         max_pts_correction=default_max_pts_correction;
         a_frame+=x; c_total+=x;
-        printf("  ct:%7.3f  %3d  %2d%%  %2d%%  %3.1f%% \r",c_total,
+        printf("  ct:%7.3f  %3d  %2d%%  %2d%%  %3.1f%% %d \r",c_total,
         (int)num_frames,
         (v_frame>0.5)?(int)(100.0*video_time_usage/(double)v_frame):0,
         (v_frame>0.5)?(int)(100.0*vout_time_usage/(double)v_frame):0,
-        (v_frame>0.5)?(100.0*audio_time_usage/(double)v_frame):0
-//        dbg_es_sent-dbg_es_rcvd 
+        (v_frame>0.5)?(100.0*audio_time_usage/(double)v_frame):0,
+        dbg_es_sent-dbg_es_rcvd
         );
         fflush(stdout);
       }
@@ -1498,13 +1469,12 @@
     if(d_video->pts) v_pts=d_video->pts;
     if(frame_corr_num==5){
 //      printf("A: ---   V:%6.1f   \r",v_pts);
-      printf("V:%6.1f  %3d  %2d%%  %2d%%  %3.1f%% \r",v_pts,
+      printf("V:%6.1f  %3d  %2d%%  %2d%%  %3.1f%% %d \r",v_pts,
         (int)num_frames,
         (v_frame>0.5)?(int)(100.0*video_time_usage/(double)v_frame):0,
         (v_frame>0.5)?(int)(100.0*vout_time_usage/(double)v_frame):0,
-        (v_frame>0.5)?(100.0*audio_time_usage/(double)v_frame):0
-//        dbg_es_sent-dbg_es_rcvd
-        );
+        (v_frame>0.5)?(100.0*audio_time_usage/(double)v_frame):0,
+        dbg_es_sent-dbg_es_rcvd);
 
       fflush(stdout);
       frame_corr_num=0;
@@ -1525,7 +1495,7 @@
           lirc_mp_getinput()<=0 &&
 #endif
           getch2(20)<=0 && mplayer_get_key()<=0){
-	  video_out->check_events();
+          video_out->check_events();
       }
       osd_function=OSD_PLAY;
   }
@@ -1578,6 +1548,20 @@
     case 'o':  // toggle OSD
       osd_level=(osd_level+1)%3;
       break;
+// --- NEW
+    case '*':
+      mixer_incvolume();
+      break;
+    case '/':
+      mixer_decvolume();
+      break;
+    case 'm':
+      mixer_usemaster=1;
+      break;;
+    case 'c':
+      mixer_usemaster=0;
+      break;
+// ---  
   }
   if(rel_seek_secs)
   if(file_format==DEMUXER_TYPE_AVI && avi_header.idx_size<=0){
@@ -1589,7 +1573,7 @@
     // clear demux buffers:
     if(has_audio) ds_free_packs(d_audio);
     ds_free_packs(d_video);
-    
+
 //    printf("sh_audio->a_buffer_len=%d  \n",sh_audio->a_buffer_len);
     sh_audio->a_buffer_len=0;
 
@@ -1601,7 +1585,7 @@
     int curr_audio_pos=0;
     int audio_chunk_pos=-1;
     int video_chunk_pos=d_video->pos;
-    
+
     skip_video_frames=0;
 
       // SEEK streams
@@ -1665,13 +1649,13 @@
         int len=0;
 
         // calc new audio position in audio stream: (using avg.bps value)
-        curr_audio_pos=(avi_video_pts) * sh_audio->wf->nAvgBytesPerSec;
+        curr_audio_pos=(avi_video_pts) * sh_audio->wf.nAvgBytesPerSec;
         if(curr_audio_pos<0)curr_audio_pos=0;
 #if 1
         curr_audio_pos&=~15; // requires for PCM formats!!!
 #else
-        curr_audio_pos/=sh_audio->wf->nBlockAlign;
-        curr_audio_pos*=sh_audio->wf->nBlockAlign;
+        curr_audio_pos/=sh_audio->wf.nBlockAlign;
+        curr_audio_pos*=sh_audio->wf.nBlockAlign;
         avi_header.audio_seekable=1;
 #endif
 
@@ -1707,21 +1691,21 @@
           if(!(sh_audio->codec->flags&CODECS_FLAG_SEEKABLE)){
 #if 0
 //             curr_audio_pos=apos; // selected audio codec can't seek in chunk
-             skip_audio_secs=(float)skip_audio_bytes/(float)sh_audio->wf->nAvgBytesPerSec;
+             skip_audio_secs=(float)skip_audio_bytes/(float)sh_audio->wf.nAvgBytesPerSec;
              //printf("Seek_AUDIO: %d bytes --> %5.3f secs\n",skip_audio_bytes,skip_audio_secs);
              skip_audio_bytes=0;
 #else
-             int d=skip_audio_bytes % sh_audio->wf->nBlockAlign;
+             int d=skip_audio_bytes % sh_audio->wf.nBlockAlign;
              skip_audio_bytes-=d;
 //             curr_audio_pos-=d;
-             skip_audio_secs=(float)d/(float)sh_audio->wf->nAvgBytesPerSec;
+             skip_audio_secs=(float)d/(float)sh_audio->wf.nAvgBytesPerSec;
              //printf("Seek_AUDIO: %d bytes --> %5.3f secs\n",d,skip_audio_secs);
 #endif
           }
           // now: audio_chunk_pos=pos in index
           //      skip_audio_bytes=bytes to skip from that chunk
           //      skip_audio_secs=time to play audio before video (if can't skip)
-          
+
           // calc skip_video_frames & adjust video pts counter:
 //          i=last;
           i=avi_header.idx_pos;
@@ -1735,7 +1719,7 @@
             }
             ++i;
           }
-          
+
       }
 
       if(verbose) printf("SEEK: idx=%d  (a:%d v:%d)  v.skip=%d  a.skip=%d/%4.3f  \n",
@@ -1768,7 +1752,7 @@
     stream_seek(demuxer->stream,newpos);
   }
   break;
-  
+
   case DEMUXER_TYPE_MPEG_ES:
   case DEMUXER_TYPE_MPEG_PS: {
   //================= seek in MPEG ==========================
@@ -1802,10 +1786,10 @@
           demux_read_data(d_audio,NULL,skip_audio_bytes);
           d_audio->pts=0; // PTS is outdated because of the raw data skipping
         }
-        
+
         current_module="resync_audio";
 
-        switch(sh_audio->codec->driver){
+        switch(has_audio){
         case 1:
           MP3_DecodeFrame(NULL,-2); // resync
           MP3_DecodeFrame(NULL,-2); // resync
@@ -1827,10 +1811,10 @@
         if(file_format==DEMUXER_TYPE_MPEG_PS)
         if(d_video->pts && d_audio->pts){
           if (d_video->pts < d_audio->pts){
-          
+
           } else {
             while(d_video->pts > d_audio->pts){
-              switch(sh_audio->codec->driver){
+              switch(has_audio){
                 case 1: MP3_DecodeFrame(NULL,-2);break; // skip MPEG frame
                 case 3: sh_audio->ac3_frame=ac3_decode_frame();break; // skip AC3 frame
                 default: ds_fill_buffer(d_audio);  // skip PCM frame
@@ -1869,7 +1853,7 @@
   }
 //  for(i=1;i<=11;i++) osd_text_buffer[10+i]=i;osd_text_buffer[10+i]=0;
 //  vo_osd_text=osd_text_buffer;
-  
+
   // find sub
   if(subtitles){
       if(sub_fps==0) sub_fps=sh_video->fps;