[MPlayer-dev-eng] mplayer is running on sgi/irix machines

Oliver Schoenbrunner oliver.schoenbrunner at jku.at
Wed Oct 24 12:39:33 CEST 2001


hi,

with this patch mplayer should be running on sgi/irix machines.
(with gcc 2.95.2 and gmake - from freeware.sgi.com)

i tested it with a few files and it seems to work fine, but
is very very slow (i made absolutely no optimizations)

i changed the order of the libs in the main makefile 
(the irix linker is quite pedantic). all other changes should 
not affect non-sgi systems.

divx ;-) playback works only with ffmpeg. opendivx just produces
garbage with my divx-files, but it doesnt work on my
redhat-box (ahem... gcc2.96) neither. (my fault???)

greetings

- oliver

oliver at zappit % diff -rN -C5 MPlayer-20011024 MPlayer-20011024.sgi
diff -rN -C5 MPlayer-20011024/Makefile MPlayer-20011024.sgi//Makefile
*** MPlayer-20011024/Makefile	Tue Oct 23 16:01:13 2001
--- MPlayer-20011024.sgi//Makefile	Wed Oct 24 11:05:10 2001
***************
*** 17,27 ****
  BINDIR = ${prefix}/bin
  # BINDIR = /usr/local/bin
  SRCS = ima4.c xacodec.c cpudetect.c postproc/swscale.c
postproc/postprocess.c mp_msg.c ac3-iec958.c find_sub.c dec_audio.c
dec_video.c codec-cfg.c subreader.c linux/getch2.c linux/timer-lx.c
linux/shmem.c xa/xa_gsm.c xa/rle8.c lirc_mp.c cfgparser.c mixer.c
spudec.c
  OBJS = $(SRCS:.c=.o)
  CFLAGS = $(OPTFLAGS) -Ilibmpdemux -Iloader -Ilibvo $(CSS_INC)
$(EXTRA_INC) $(MADLIB_INC) # -Wall
! A_LIBS = -Lmp3lib -lMP3 -Llibac3 -lac3 $(ALSA_LIB) $(ESD_LIB)
$(MADLIB_LIB)
  VO_LIBS = -Llibvo -lvo $(MLIB_LIB) $(X_LIBS)
  
  PARTS = libmpdemux mp3lib libac3 libmpeg2 opendivx libavcodec encore
libvo libao2 drivers drivers/syncfb
  ifeq ($(GUI),yes)
  PARTS += Gui
--- 17,27 ----
  BINDIR = ${prefix}/bin
  # BINDIR = /usr/local/bin
  SRCS = ima4.c xacodec.c cpudetect.c postproc/swscale.c
postproc/postprocess.c mp_msg.c ac3-iec958.c find_sub.c dec_audio.c
dec_video.c codec-cfg.c subreader.c linux/getch2.c linux/timer-lx.c
linux/shmem.c xa/xa_gsm.c xa/rle8.c lirc_mp.c cfgparser.c mixer.c
spudec.c
  OBJS = $(SRCS:.c=.o)
  CFLAGS = $(OPTFLAGS) -Ilibmpdemux -Iloader -Ilibvo $(CSS_INC)
$(EXTRA_INC) $(MADLIB_INC) # -Wall
! A_LIBS = -Lmp3lib -lMP3 -Llibac3 -lac3 $(ALSA_LIB) $(ESD_LIB)
$(MADLIB_LIB) $(SGI_AUDIO_LIB)
  VO_LIBS = -Llibvo -lvo $(MLIB_LIB) $(X_LIBS)
  
  PARTS = libmpdemux mp3lib libac3 libmpeg2 opendivx libavcodec encore
libvo libao2 drivers drivers/syncfb
  ifeq ($(GUI),yes)
  PARTS += Gui
***************
*** 94,104 ****
  endif
  mplayerwithoutlink: $(MPLAYER_DEP)	
  	@for a in $(PARTS); do $(MAKE) -C $$a all ; done
  
  $(PRG):	$(MPLAYER_DEP)
! 	$(CC) -rdynamic $(CFLAGS) -o $(PRG) mplayer.o -Llibmpdemux -lmpdemux
$(OBJS) $(XMM_LIBS) $(LIRC_LIBS) $(A_LIBS) -lm $(TERMCAP_LIB)
$(LIB_LOADER) $(AV_LIB) -Llibmpeg2 -lmpeg2 -Llibao2 -lao2 $(VO_LIBS)
$(CSS_LIB) -Lencore -lencore $(DECORE_LIBS) $(GUI_LIBS) $(ARCH_LIBS)
  
  $(PRG_FIBMAP): fibmap_mplayer.o
  	$(CC) -o $(PRG_FIBMAP) fibmap_mplayer.o
  
  # $(PRG_HQ):	depfile mplayerHQ.o $(OBJS) loader/libloader.a
libmpeg2/libmpeg2.a opendivx/libdecore.a $(COMMONLIBS)
encore/libencore.a
--- 94,104 ----
  endif
  mplayerwithoutlink: $(MPLAYER_DEP)	
  	@for a in $(PARTS); do $(MAKE) -C $$a all ; done
  
  $(PRG):	$(MPLAYER_DEP)
! 	$(CC) -rdynamic $(CFLAGS) -o $(PRG) mplayer.o -Llibmpdemux -lmpdemux
$(OBJS) $(XMM_LIBS) $(LIRC_LIBS) $(TERMCAP_LIB) $(LIB_LOADER) $(AV_LIB)
-Llibmpeg2 -lmpeg2 -Llibao2 -lao2 $(A_LIBS) $(VO_LIBS) $(CSS_LIB)
-Lencore -lencore $(DECORE_LIBS) $(GUI_LIBS) $(ARCH_LIBS) -lm 
  
  $(PRG_FIBMAP): fibmap_mplayer.o
  	$(CC) -o $(PRG_FIBMAP) fibmap_mplayer.o
  
  # $(PRG_HQ):	depfile mplayerHQ.o $(OBJS) loader/libloader.a
libmpeg2/libmpeg2.a opendivx/libdecore.a $(COMMONLIBS)
encore/libencore.a
diff -rN -C5 MPlayer-20011024/configure MPlayer-20011024.sgi//configure
*** MPlayer-20011024/configure	Wed Oct 24 05:09:23 2001
--- MPlayer-20011024.sgi//configure	Wed Oct 24 11:12:37 2001
***************
*** 802,811 ****
--- 802,824 ----
      proc=
      _march=""
      _mcpu="-mcpu=ev56"
      ;;
  
+ mips)
+     _arch="#define ARCH_SGI_MIPS 1"
+     _target_arch="TARGET_ARCH_SGI_MIPS=yes"
+     _words_endian="#define WORDS_BIGENDIAN 1"
+     iproc=sgi-mips
+     proc=default
+     _march=""
+     _mcpu="-mcpu=$proc"
+     _skip_as_check=yes
+     # _png=no
+     # CFLAGS="-O4 $_march $_mcpu -ffast-math -fomit-frame-pointer"
+     ;;
+ 
  *)
      echo "The architecture of your CPU ($host_arch) is not supported
by this configure script"
      echo "It seems noone has ported MPlayer to your OS or CPU type
yet."
      die "unsupported architecture $host_arch"
      ;;
***************
*** 1180,1189 ****
--- 1193,1210 ----
  #include <esd.h>
  int main( void ){ return 0; }
  EOF
  cc_check $_extraincdir $_extralibdir -lesd || _esd=no
  
+ # check for SGI audio
+ cat > $TMPC << EOF
+ #include <dmedia/audio.h>
+ int main( void ) { return 0; }
+ EOF
+ 
+ _sgi_audio=no
+ $_cc -o $TMPO $TMPC 2> /dev/null && _sgi_audio=yes
  
  # check for mad library
  cat > $TMPC << EOF
  #include <mad.h>
  int main(void) { return 0; }
***************
*** 1654,1663 ****
--- 1675,1685 ----
  echo "Checking for OSS Audio ... $_oss_audio"
  echo "Checking for ALSA Audio ... $_alsaver"
  echo "Checking for ESD Audio ... $_esd"
  echo "Checking for Sun Audio ... $_sun_audio"
  echo "Checking for Sun mediaLib ... $_mlib"
+ echo "Checking for SGI Audio ... $_sgi_audio"
  echo "Checking for DeCSS support ... $_css"
  echo "Checking for DVDread support ... $_dvdread"
  echo "Checking for PNG support ... $_png"
  echo "Checking for mad support ... $_mad"
  echo "Checking for OggVorbis support ... $_vorbis"
***************
*** 1993,2002 ****
--- 2015,2032 ----
   _aosrc="$_aosrc ao_sun.c"
  else
   _sunaudio='#undef USE_SUN_AUDIO'
  fi
  
+ if [ "$_sgi_audio" = "yes" ]; then
+  _sgiaudio='#define USE_SGI_AUDIO'
+  _aosrc="$_aosrc ao_sgi.c"
+  _sgi_audio_lib='-laudio'
+ else
+  _sgiaudio='#undef USE_SGI_AUDIO'
+ fi
+ 
  if test "$_sys_soundcard_h" = yes ; then
   _have_soundcard_h='#define HAVE_SYS_SOUNDCARD_H 1'
  else
   _have_soundcard_h='#undef  HAVE_SYS_SOUNDCARD_H'
  fi
***************
*** 2034,2045 ****
  
  
  # Checking for CFLAGS
  if test "$_profile" || test "$_debug" ; then
   CFLAGS="-W -Wall -O2 $_march $_mcpu $_debug $_profile"
! elif test -z "$CFLAGS" ; then
!  CFLAGS="-O4 $_march $_mcpu -pipe -ffast-math -fomit-frame-pointer"
  else
   cat <<EOF
  MPlayer is using custom CFLAGS set by you, it is strongly recommended
that you
  let MPlayer choose the correct CFLAGS!
  To do so execute CFLAGS= ./configure <your options>
--- 2064,2079 ----
  
  
  # Checking for CFLAGS
  if test "$_profile" || test "$_debug" ; then
   CFLAGS="-W -Wall -O2 $_march $_mcpu $_debug $_profile"
! elif test -z "$CFLAGS" ; then 
!  if [ "$host_arch" != "mips" ]; then
!   CFLAGS="-O4 $_march $_mcpu -pipe -ffast-math -fomit-frame-pointer"
!  else
!   CFLAGS="-O4 $_march $_mcpu -ffast-math -fomit-frame-pointer"
!  fi
  else
   cat <<EOF
  MPlayer is using custom CFLAGS set by you, it is strongly recommended
that you
  let MPlayer choose the correct CFLAGS!
  To do so execute CFLAGS= ./configure <your options>
***************
*** 2328,2337 ****
--- 2362,2372 ----
  DS_LIB = $_dshowlib
  AV_DEP = $_lavcdep
  AV_LIB = $_lavclib
  ALSA_LIB = $_alsalib
  ESD_LIB = $_esdlib
+ SGI_AUDIO_LIB = $_sgi_audio_lib
  ARCH_LIBS = $_archlibs $_iconvlib
  STREAMING=$_streaming
  DECORE_LIBS = $_decorelibs
  DIVX4LINUX=$_divx4linux
  MLIB_INC = $_mlibinc
***************
*** 2484,2493 ****
--- 2519,2529 ----
  $_ossaudio
  $_alsa5
  $_alsa9
  $_esdd
  $_sunaudio
+ $_sgiaudio
  
  /* Enable fast OSD/SUB renderer (looks ugly, but uses less CPU power)
*/
  #undef FAST_OSD
  #undef FAST_OSD_TABLE
  
diff -rN -C5 MPlayer-20011024/libao2/ao_sgi.c
MPlayer-20011024.sgi//libao2/ao_sgi.c
*** MPlayer-20011024/libao2/ao_sgi.c
--- MPlayer-20011024.sgi//libao2/ao_sgi.c	Wed Oct 24 11:15:27 2001
***************
*** 0 ****
--- 1,199 ----
+ /*
+   ao_sgi - sgi/irix output plugin for MPlayer
+ 
+   22oct2001 oliver.schoenbrunner at jku.at
+   
+ */
+ 
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <dmedia/audio.h>
+ 
+ #include "audio_out.h"
+ #include "audio_out_internal.h"
+ 
+ static ao_info_t info = 
+ {
+ 	"sgi audio output",
+ 	"sgi",
+ 	"kopflos",
+ 	""
+ };
+ 
+ LIBAO_EXTERN(sgi)
+ 
+ // there are some globals:
+ // ao_samplerate
+ // ao_channels
+ // ao_format
+ // ao_bps
+ // ao_outburst
+ // ao_buffersize
+ 
+ static ALconfig	ao_config;
+ static ALport	ao_port;
+ 
+ // to set/get/query special features/parameters
+ static int control(int cmd, int arg){
+   
+   printf("ao_sgi, control\n");
+   
+   return -1;
+ }
+ 
+ // open & setup audio device
+ // return: 1=success 0=fail
+ static int init(int rate, int channels, int format, int flags) {
+   
+   printf("ao_sgi, init: Samplerate: %iHz Channels: %s Format %s\n",
rate, (channels > 1) ? "Stereo" : "Mono",
audio_out_format_name(format));
+   
+   { /* from /usr/share/src/dmedia/audio/setrate.c */
+   
+     int fd;
+     int rv;
+     double frate;
+     ALpv x[2];
+ 
+     rv = alGetResourceByName(AL_SYSTEM, "out.analog", AL_DEVICE_TYPE);
+     if (!rv) {
+       printf("ao_sgi, play: invalid device\n");
+       return 0;
+     }
+     
+     frate = rate;
+ 
+     x[0].param = AL_RATE;
+     x[0].value.ll = alDoubleToFixed(rate);
+     x[1].param = AL_MASTER_CLOCK;
+     x[1].value.i = AL_CRYSTAL_MCLK_TYPE;
+ 
+     if (alSetParams(rv,x, 2)<0) {
+       printf("ao_sgi, init: setparams failed: %s\n",
alGetErrorString(oserror()));
+       printf("ao_sgi, init: could not set desired samplerate\n"); 
+     }
+     
+     if (x[0].sizeOut < 0) {
+       printf("ao_sgi, init: AL_RATE was not accepted on the given
resource\n");
+     }
+ 
+     if (alGetParams(rv,x, 1)<0) {
+       printf("ao_sgi, init: getparams failed: %s\n",
alGetErrorString(oserror()));
+     }
+     
+     if (frate != alFixedToDouble(x[0].value.ll)) {
+       printf("ao_sgi, init: samplerate is now %lf (desired rate is
%lf)\n", alFixedToDouble(x[0].value.ll), frate);
+     } 
+ 
+   }
+   
+   ao_buffersize=131072;
+   ao_outburst = ao_buffersize/16;
+   ao_channels = channels;
+   
+   ao_config = alNewConfig();
+   
+   if (!ao_config) {
+     printf("ao_sgi, init: %s\n", alGetErrorString(oserror()));
+     return 0;
+   }
+   
+   if(channels == 2) alSetChannels(ao_config, AL_STEREO);
+   else alSetChannels(ao_config, AL_MONO);
+   
+   alSetWidth(ao_config, AL_SAMPLE_16);
+   alSetSampFmt(ao_config, AL_SAMPFMT_TWOSCOMP);
+   alSetQueueSize(ao_config, 48000);
+   
+   if (alSetDevice(ao_config, AL_DEFAULT_OUTPUT) < 0) {
+     printf("ao_sgi, init: %s\n", alGetErrorString(oserror()));
+     return 0;
+   }
+   
+   ao_port = alOpenPort("mplayer", "w", ao_config);
+   
+   if (!ao_port) {
+     printf("ao_sgi, init: Unable to open audio channel: %s\n",
alGetErrorString(oserror()));
+     return 0;
+   }
+   
+   // printf("ao_sgi, init: port %d config %d\n", ao_port, ao_config);
+   
+   return 1;  
+ 
+ }
+ 
+ // close audio device
+ static void uninit() {
+ 
+   /* TODO: samplerate should be set back to the value before mplayer
was started! */
+ 
+   printf("ao_sgi, uninit: ...\n");
+ 
+   if (ao_port) {
+     while(alGetFilled(ao_port) > 0) sginap(1);  
+     alClosePort(ao_port);
+     alFreeConfig(ao_config);
+   }
+ 	
+ }
+ 
+ // stop playing and empty buffers (for seeking/pause)
+ static void reset() {
+   
+   printf("ao_sgi, reset: ...\n");
+   
+ }
+ 
+ // stop playing, keep buffers (for pause)
+ static void audio_pause() {
+     
+   printf("ao_sgi, audio_pause: ...\n");
+     
+ }
+ 
+ // resume playing, after audio_pause()
+ static void audio_resume() {
+ 
+   printf("ao_sgi, audio_resume: ...\n");
+ 
+ }
+ 
+ // return: how many bytes can be played without blocking
+ static int get_space() {
+   
+   // printf("ao_sgi, get_space: (ao_outburst %d)\n", ao_outburst);
+   // printf("ao_sgi, get_space: alGetFillable [%d] \n",
alGetFillable(ao_port));
+   
+   return alGetFillable(ao_port)*(2*ao_channels);
+     
+ }
+ 
+ 
+ // plays 'len' bytes of 'data'
+ // it should round it down to outburst*n
+ // return: number of bytes played
+ static int play(void* data, int len, int flags) {
+     
+   // printf("ao_sgi, play: len %d flags %d (%d %d)\n", len, flags,
ao_port, ao_config);
+   // printf("channels %d\n", ao_channels);
+ 
+   alWriteFrames(ao_port, data, len/(2*ao_channels));
+   
+   return len;
+   
+ }
+ 
+ // return: how many unplayed bytes are in the buffer
+ static int get_delay(){
+   
+   // printf("ao_sgi, get_delay: (ao_buffersize %d)\n", ao_buffersize);
+   
+   return 0;
+ 
+ }
+ 
+ 
+ 
+ 
+ 
+ 
diff -rN -C5 MPlayer-20011024/libao2/audio_out.c
MPlayer-20011024.sgi//libao2/audio_out.c
*** MPlayer-20011024/libao2/audio_out.c	Tue Aug 28 12:54:31 2001
--- MPlayer-20011024.sgi//libao2/audio_out.c	Wed Oct 24 11:16:02 2001
***************
*** 32,41 ****
--- 32,44 ----
  extern ao_functions_t audio_out_sdl;
  #endif
  #ifdef USE_SUN_AUDIO
  extern ao_functions_t audio_out_sun;
  #endif
+ #ifdef USE_SGI_AUDIO
+ extern ao_functions_t audio_out_sgi;
+ #endif
  extern ao_functions_t audio_out_pcm;
  extern ao_functions_t audio_out_pss;
  
  ao_functions_t* audio_out_drivers[] =
  {
***************
*** 43,52 ****
--- 46,58 ----
          &audio_out_oss,
  #endif
  #ifdef USE_SUN_AUDIO
          &audio_out_sun,
  #endif
+ #ifdef USE_SGI_AUDIO
+         &audio_out_sgi,
+ #endif
          &audio_out_null,
  #ifdef HAVE_ALSA5
  	&audio_out_alsa5,
  #endif
  #ifdef HAVE_ALSA9
***************
*** 82,92 ****
  	case AFMT_U16_BE: 
  	    return("Unsigned 16-bit (Big-Endian)");
  	case AFMT_S16_LE:
  	    return("Signed 16-bit (Little-Endian)");
  	case AFMT_S16_BE:
! 	    return("Unsigned 16-bit (Big-Endian)");
  	case AFMT_MPEG:
  	    return("MPEG (2) audio");
  	case AFMT_AC3:
  	    return("AC3");
  /*
--- 88,98 ----
  	case AFMT_U16_BE: 
  	    return("Unsigned 16-bit (Big-Endian)");
  	case AFMT_S16_LE:
  	    return("Signed 16-bit (Little-Endian)");
  	case AFMT_S16_BE:
! 	    return("Signed 16-bit (Big-Endian)");
  	case AFMT_MPEG:
  	    return("MPEG (2) audio");
  	case AFMT_AC3:
  	    return("AC3");
  /*
diff -rN -C5 MPlayer-20011024/libmpdemux/vcd_read.h
MPlayer-20011024.sgi//libmpdemux/vcd_read.h
*** MPlayer-20011024/libmpdemux/vcd_read.h	Fri Oct  5 02:39:38 2001
--- MPlayer-20011024.sgi//libmpdemux/vcd_read.h	Wed Oct 24 11:03:11 2001
***************
*** 275,280 ****
--- 275,284 ----
  static int vcd_read(int fd,char *mem)
  {
    return -1;
  }
  
+ static inline void vcd_set_msf(unsigned int sect)
+ {
+ }
+ 
  #endif /* !linux && !sun */
diff -rN -C5 MPlayer-20011024/mp3lib/Makefile
MPlayer-20011024.sgi//mp3lib/Makefile
*** MPlayer-20011024/mp3lib/Makefile	Wed Aug  8 08:58:12 2001
--- MPlayer-20011024.sgi//mp3lib/Makefile	Wed Oct 24 11:25:48 2001
***************
*** 2,11 ****
--- 2,14 ----
  include ../config.mak
  
  SRCS = sr1.c
  OBJS = sr1.o
  # OBJS = $(SRCS:.c,.s=.o)
+ ifeq ($(TARGET_ARCH_SGI_MIPS),yes)
+ OPTFLAGS := $(OPTFLAGS:-O4=-O0)
+ endif
  CFLAGS  = $(OPTFLAGS) $(EXTRA_INC)
  ifeq ($(TARGET_ARCH_X86),yes)
  SRCS += d_cpu.s decode_i586.s
  OBJS += d_cpu.o decode_i586.o
  ifeq ($(TARGET_MMX),yes)



More information about the MPlayer-dev-eng mailing list