0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00

Solaris 8 support - patch by Marcus Comstedt <marcus@idonex.se>

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1021 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
arpi_esp 2001-06-05 02:26:56 +00:00
parent 72cfe9c77c
commit 460fac7462
8 changed files with 154 additions and 24 deletions

47
configure vendored
View File

@ -149,11 +149,11 @@ TMPC="mplayer-conf-${RANDOM}-$$-${RANDOM}.c"
TMPO="mplayer-conf-${RANDOM}-$$-${RANDOM}.o"
TMPS="mplayer-conf-${RANDOM}-$$-${RANDOM}.S"
if [ ! -z $TMPDIR ]; then
if [ ! -z "$TMPDIR" ]; then
TMPC="${TMPDIR}/${TMPC}"
TMPO="${TMPDIR}/${TMPO}"
TMPS="${TMPDIR}/${TMPS}"
elif [ ! -z $TEMPDIR ]; then
elif [ ! -z "$TEMPDIR" ]; then
TMPC="${TEMPDIR}/${TMPC}"
TMPO="${TEMPDIR}/${TMPO}"
TMPS="${TEMPDIR}/${TMPS}"
@ -175,10 +175,10 @@ _cc=gcc
_x11=auto
_x11libdir=
if [ -e /usr/X11R6 ]; then
if [ -d /usr/X11R6 ]; then
_x11libdir=-L/usr/X11R6/lib
else
if [ -e /usr/X11 ]; then
if [ -d /usr/X11 ]; then
_x11libdir=-L/usr/X11/lib
fi
fi
@ -327,10 +327,10 @@ done
_win32libdirnotify=no
if [ -e /usr/lib/win32 ]; then
if [ -d /usr/lib/win32 ]; then
_win32libdir=/usr/lib/win32
else
if [ -e /usr/local/lib/win32 ]; then
if [ -d /usr/local/lib/win32 ]; then
_win32libdir=/usr/local/lib/win32
else
# This is our default:
@ -340,7 +340,7 @@ else
fi
if [ -e /dev/mga_vid ]; then
if [ -c /dev/mga_vid ]; then
_mga=yes
_syncfb=yes
fi
@ -487,8 +487,9 @@ $_cc $TMPC -o $TMPO -lpthread &> /dev/null || \
# Atmosfear: added SDL versioncheck and autodetect; removed warnings.
_sdl=no
if $_cc $TMPC -o $TMPO `$_sdlconfig --libs` &> /dev/null ; then
if test `$_sdlconfig --version | sed s/[=[:punct:]=]//g` -gt 116 ; then
if test `$_sdlconfig --version | sed s/[=[:punct:]=]//g` -lt 121 ; then
if test `$_sdlconfig --version | sed s/[^0-9]//g` -gt 116 ; then
if test `$_sdlconfig --version | sed s/[^0-9]//g` -lt 121 ; then
_sdlbuggy='#define BUGGY_SDL'
else
_sdlbuggy='#undef BUGGY_SDL'
@ -521,7 +522,7 @@ _termcap=no
$_cc $TMPC -o $TMPO -ltermcap &> /dev/null && _termcap=yes
_png=no
$_cc $TMPC -o $TMPO -lpng -lz&> /dev/null && _png=yes
$_cc $TMPC -o $TMPO -lpng -lz -lm &> /dev/null && _png=yes
_binutils=no
as libac3/downmix/downmix_i386.S -o $TMPO &> /dev/null && _binutils=yes
@ -530,24 +531,28 @@ as libac3/downmix/downmix_i386.S -o $TMPO &> /dev/null && _binutils=yes
# ----------- Check X11 and related libs (GL, Xxf86vm, Xv, DGA) --------------
# for Solaris:
_socklib=
$_cc $TMPC -o $TMPO -lsocket >/dev/null 2>&1 && _socklib=-lsocket
if [ $_x11 = auto ]; then
_x11=no
$_cc $TMPC -o $TMPO $_x11libdir -lX11 -lXext &> /dev/null && _x11=yes
$_cc $TMPC -o $TMPO $_x11libdir -lX11 -lXext $_socklib &> /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 -lX11 -lXext -lXv &> /dev/null && _xv=yes
$_cc $TMPC -o $TMPO $_x11libdir -lX11 -lXext -lXxf86vm &> /dev/null && _vm=yes
$_cc $TMPC -o $TMPO $_x11libdir -lX11 -lXext -lXdpms $_socklib &> /dev/null && _xdpms=yes
$_cc $TMPC -o $TMPO $_x11libdir -lX11 -lXext -lXv $_socklib &> /dev/null && _xv=yes
$_cc $TMPC -o $TMPO $_x11libdir -lX11 -lXext -lXxf86vm $_socklib &> /dev/null && _vm=yes
$_cc $TMPC -o $TMPO $_x11libdir -lX11 -lXext -lGL &> /dev/null && _gl=yes
$_cc $TMPC -o $TMPO $_x11libdir -lX11 -lXext -lGL $_socklib &> /dev/null && _gl=yes
cat > $TMPC << EOF
#include <GL/gl.h>
int main( void ) { return 0; }
EOF
$_cc $TMPC -o $TMPO $_x11libdir -lX11 -lXext -lGL &> /dev/null || \
$_cc $TMPC -o $TMPO $_x11libdir -lX11 -lXext -lGL $_socklib &> /dev/null || \
{ _gl=no; echo "GL includes not found!";}
cat > $TMPC << EOF
@ -557,7 +562,7 @@ cat > $TMPC << EOF
int main (void) { return 0;}
EOF
$_cc $TMPC -o $TMPO -L/usr/X11R6/lib -L/usr/X11/lib -lX11 -lXext -lXxf86dga -lXxf86vm &> /dev/null && _dga=yes
$_cc $TMPC -o $TMPO -L/usr/X11R6/lib -L/usr/X11/lib -lX11 -lXext -lXxf86dga -lXxf86vm $_socklib &> /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
# stuffs named 'X extensions' or something similar. This check can be usefull
@ -573,7 +578,7 @@ int main (void) { XDGAMode mode; XDGADevice device; return 0;}
EOF
_dga2=no
$_cc $TMPC -o $TMPO -L/usr/X11R6/lib -L/usr/X11/lib -lX11 -lXext -lXxf86dga -lXxf86vm &> /dev/null && _dga2=yes
$_cc $TMPC -o $TMPO -L/usr/X11R6/lib -L/usr/X11/lib -lX11 -lXext -lXxf86dga -lXxf86vm $_socklib &> /dev/null && _dga2=yes
fi
@ -904,13 +909,13 @@ if [ $_gl = yes ]; then
fi
if [ $_css = yes ]; then
if [ ! -z $_csslibdir ]; then
if [ ! -z "$_csslibdir" ]; then
_csslib="-L${_csslibdir} -lcss"
else
_csslib='-lcss'
fi
_css='#define HAVE_LIBCSS'
if [ ! -z $_cssincdir ]; then
if [ ! -z "$_cssincdir" ]; then
_cssinc="-I${_cssincdir}"
else
_cssinc=""
@ -1012,7 +1017,7 @@ X11DIR=$_x11libdir
# OPTFLAGS=-O4 $_profile $_debug -march=$proc -mcpu=$proc -pipe -fomit-frame-pointer -ffast-math
OPTFLAGS=$CFLAGS
# LIBS=-L/usr/lib -L/usr/local/lib $_x11libdir $_gllib $_sdllib $_dgalib $_x11lib $_xvlib
X_LIBS=$_x11libdir $_gllib $_sdllib $_dgalib $_x11lib $_xvlib $_vmlib $_svgalib $_libpng
X_LIBS=$_x11libdir $_gllib $_sdllib $_dgalib $_x11lib $_xvlib $_vmlib $_svgalib $_libpng $_socklib
TERMCAP_LIB=$_libtermcap
XMM_LIBS = $_xmmplibs
LIRC_LIBS = $_lirclibs

View File

@ -2,7 +2,16 @@
#include <stdio.h>
#include <stdlib.h>
#ifdef __sun
#include <sys/audioio.h>
#define AFMT_MU_LAW AUDIO_ENCODING_ULAW
#define AFMT_A_LAW AUDIO_ENCODING_ALAW
#define AFMT_S16_LE AUDIO_ENCODING_LINEAR
#define AFMT_IMA_ADPCM AUDIO_ENCODING_DVI
#define AFMT_U8 AUDIO_ENCODING_LINEAR8
#else
#include <sys/soundcard.h>
#endif
#include "config.h"
@ -161,7 +170,9 @@ case 2: {
case 0x6: sh_audio->sample_format=AFMT_A_LAW;break;
case 0x7: sh_audio->sample_format=AFMT_MU_LAW;break;
case 0x11: sh_audio->sample_format=AFMT_IMA_ADPCM;break;
#ifndef __sun
case 0x50: sh_audio->sample_format=AFMT_MPEG;break;
#endif
// case 0x2000: sh_audio->sample_format=AFMT_AC3;
default: sh_audio->sample_format=(sh_audio->samplesize==2)?AFMT_S16_LE:AFMT_U8;
}

View File

@ -7,7 +7,11 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#ifdef __sun
#include <sys/audioio.h>
#else
#include <sys/soundcard.h>
#endif
#include "../config.h"
@ -32,9 +36,14 @@ LIBAO_EXTERN(oss)
// ao_outburst
// ao_buffersize
static char* dsp="/dev/dsp";
static int audio_fd=-1;
#ifdef __sun
static char *dsp="/dev/audio";
static int queued_bursts = 0;
#else
static char *dsp="/dev/dsp";
static audio_buf_info zz;
#endif
static int audio_fd=-1;
// to set/get/query special features/parameters
static int control(int cmd,int arg){
@ -60,6 +69,22 @@ static int init(int rate,int channels,int format,int flags){
return 0;
}
#ifdef __sun
{
audio_info_t info;
ioctl(audio_fd, AUDIO_GETINFO, &info);
ioctl(audio_fd, AUDIO_DRAIN, 0);
info.play.encoding = ao_format = format;
info.play.precision = (format==AUDIO_ENCODING_LINEAR? AUDIO_PRECISION_16:AUDIO_PRECISION_8);
info.play.channels = ao_channels = channels;
--ao_channels;
info.play.sample_rate = ao_samplerate = rate;
if(ioctl (audio_fd, AUDIO_SETINFO, &info)<0)
printf("audio_setup: your card doesn't support %d Hz samplerate\n",rate);
ao_outburst=8192;
queued_bursts = 0;
}
#else
ao_format=format;
ioctl (audio_fd, SNDCTL_DSP_SETFMT, &ao_format);
printf("audio_setup: sample format: 0x%X (requested: 0x%X)\n",ao_format,format);
@ -87,6 +112,7 @@ static int init(int rate,int channels,int format,int flags){
if(ao_buffersize==-1) ao_buffersize=zz.bytes;
ao_outburst=zz.fragsize;
}
#endif
if(ao_buffersize==-1){
// Measuring buffer size:
@ -109,6 +135,9 @@ static int init(int rate,int channels,int format,int flags){
printf("Recompile mplayer with #undef HAVE_AUDIO_SELECT in config.h !\n\n");
return 0;
}
#ifdef __sun
ioctl(audio_fd, AUDIO_DRAIN, 0);
#endif
#endif
}
@ -117,7 +146,9 @@ static int init(int rate,int channels,int format,int flags){
// close audio device
static void uninit(){
#ifdef SNDCTL_DSP_RESET
ioctl(audio_fd, SNDCTL_DSP_RESET, NULL);
#endif
close(audio_fd);
}
@ -130,9 +161,23 @@ static void reset(){
return;
}
#ifdef __sun
{
audio_info_t info;
ioctl(audio_fd, AUDIO_GETINFO, &info);
ioctl(audio_fd, AUDIO_DRAIN, 0);
info.play.encoding = ao_format;
info.play.precision = (ao_format==AUDIO_ENCODING_LINEAR? AUDIO_PRECISION_16:AUDIO_PRECISION_8);
info.play.channels = ao_channels+1;
info.play.sample_rate = ao_samplerate;
ioctl (audio_fd, AUDIO_SETINFO, &info);
queued_bursts = 0;
}
#else
ioctl (audio_fd, SNDCTL_DSP_SETFMT, &ao_format);
ioctl (audio_fd, SNDCTL_DSP_STEREO, &ao_channels);
ioctl (audio_fd, SNDCTL_DSP_SPEED, &ao_samplerate);
#endif
}
@ -140,10 +185,12 @@ static void reset(){
static int get_space(){
int playsize=ao_outburst;
#ifdef SNDCTL_DSP_GETOSPACE
if(ioctl(audio_fd, SNDCTL_DSP_GETOSPACE, &zz)!=-1){
// calculate exact buffer space:
return zz.fragments*zz.fragsize;
}
#endif
// check buffer
#ifdef HAVE_AUDIO_SELECT
@ -157,7 +204,15 @@ static int get_space(){
}
#endif
return ao_outburst;
#ifdef __sun
{
audio_info_t info;
ioctl(audio_fd, AUDIO_GETINFO, &info);
if(queued_bursts - info.play.eof > 2)
return 0;
}
#endif
return ao_outburst;
}
// plays 'len' bytes of 'data'
@ -166,6 +221,12 @@ static int get_space(){
static int play(void* data,int len,int flags){
len/=ao_outburst;
len=write(audio_fd,data,len*ao_outburst);
#ifdef __sun
if(len>0) {
queued_bursts ++;
write(audio_fd,data,0);
}
#endif
return len;
}
@ -173,6 +234,14 @@ static int audio_delay_method=2;
// return: how many unplayed bytes are in the buffer
static int get_delay(){
#ifdef __sun
{
int q;
audio_info_t info;
ioctl(audio_fd, AUDIO_GETINFO, &info);
return (queued_bursts - info.play.eof) * ao_outburst;
}
#else
if(audio_delay_method==2){
//
int r=0;
@ -187,5 +256,6 @@ static int get_delay(){
audio_delay_method=0; // fallback if not supported
}
return ao_buffersize;
#endif
}

View File

@ -176,6 +176,7 @@ void Setup_LDT_Keeper(){
#endif /* __NetBSD__ || __FreeBSD__ || __OpenBSD__ */
#if defined(__svr4__)
{
struct ssd ssd;
ssd.sel = TEB_SEL;
ssd.bo = array.base_addr;
@ -188,6 +189,7 @@ void Setup_LDT_Keeper(){
perror("sysi86(SI86DSCR)");
printf("Couldn't install fs segment, expect segfault\n");
}
}
#endif
setup_FS_Segment();

21
mixer.c
View File

@ -1,14 +1,22 @@
#include <string.h>
#include <sys/ioctl.h>
#ifdef __sun
#include <sys/audioio.h>
#else
#include <sys/soundcard.h>
#endif
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#include "mixer.h"
#ifdef __sun
char * mixer_device="/dev/audioctl";
#else
char * mixer_device="/dev/mixer";
#endif
int mixer_usemaster=0;
void mixer_getvolume( int *l,int *r )
@ -18,6 +26,11 @@ void mixer_getvolume( int *l,int *r )
fd=open( mixer_device,O_RDONLY );
if ( fd != -1 )
{
#ifdef __sun
audio_info_t info;
ioctl( fd,AUDIO_GETINFO,&info );
*r=*l=(info.play.gain * 100 + (AUDIO_MAX_GAIN-1))/AUDIO_MAX_GAIN;
#else
ioctl( fd,SOUND_MIXER_READ_DEVMASK,&devs );
if ( ( devs & SOUND_MASK_PCM ) && ( mixer_usemaster==0 ) ) cmd=SOUND_MIXER_READ_PCM;
else
@ -30,6 +43,7 @@ void mixer_getvolume( int *l,int *r )
ioctl( fd,cmd,&v );
*r=( v & 0xFF00 ) >> 8;
*l=( v & 0x00FF );
#endif
close( fd );
}
}
@ -41,6 +55,12 @@ void mixer_setvolume( int l,int r )
fd=open( mixer_device,O_RDONLY );
if ( fd != -1 )
{
#ifdef __sun
audio_info_t info;
ioctl( fd,AUDIO_GETINFO,&info );
info.play.gain = ((l+r)*AUDIO_MAX_GAIN+199)/200;
ioctl( fd,AUDIO_SETINFO,&info );
#else
ioctl( fd,SOUND_MIXER_READ_DEVMASK,&devs );
if ( ( devs & SOUND_MASK_PCM ) && ( mixer_usemaster==0 ) ) cmd=SOUND_MIXER_WRITE_PCM;
else
@ -52,6 +72,7 @@ void mixer_setvolume( int l,int r )
}
v=( r << 8 ) | l;
ioctl( fd,cmd,&v );
#endif
close( fd );
}
}

View File

@ -16,7 +16,11 @@
#include <sys/time.h>
#include <sys/stat.h>
#include <fcntl.h>
#ifdef __sun
#include <sys/audioio.h>
#else
#include <sys/soundcard.h>
#endif
#include "version.h"
#include "config.h"
@ -501,7 +505,11 @@ int f; // filedes
#endif
if(!filename){
#ifdef __sun
if(vcd_track) filename="/vol/dev/aliases/cdrom0";
#else
if(vcd_track) filename="/dev/cdrom";
#endif
else {
printf("%s",help_text); exit(0);
}

View File

@ -13,8 +13,12 @@
#include <sys/cdio.h>
#include <sys/cdrio.h>
#else
#ifdef __sun
#include <sys/cdio.h>
#else
#include <linux/cdrom.h>
#endif
#endif
#include "stream.h"

View File

@ -68,8 +68,17 @@ void vcd_read_toc(int fd){
static char vcd_buf[VCD_SECTOR_SIZE];
static int vcd_read(int fd,char *mem){
#ifdef __sun
struct cdrom_cdxa xa;
xa.cdxa_addr = vcd_get_msf();
xa.cdxa_length = CDROM_BLK_2352;
xa.cdxa_data = vcd_buf;
xa.cdxa_format = CDROM_XA_SECTOR_DATA;
if(ioctl(fd,CDROMCDXA,&xa)==-1) return 0; // EOF?
#else
memcpy(vcd_buf,&vcd_entry.cdte_addr.msf,sizeof(struct cdrom_msf));
if(ioctl(fd,CDROMREADRAW,vcd_buf)==-1) return 0; // EOF?
#endif
vcd_entry.cdte_addr.msf.frame++;
if (vcd_entry.cdte_addr.msf.frame==75){