summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuenter Bartsch <guenter@users.sourceforge.net>2001-06-21 17:34:23 +0000
committerGuenter Bartsch <guenter@users.sourceforge.net>2001-06-21 17:34:23 +0000
commit436b928915f56a8bc56fc7065800fad7e474e158 (patch)
tree9d0680a8099f22e639058ce366e79032129f13f7
parenta2c0482e17a5d1d0ea99d06b81e94c0e7b5cb4e2 (diff)
downloadxine-lib-436b928915f56a8bc56fc7065800fad7e474e158.tar.gz
xine-lib-436b928915f56a8bc56fc7065800fad7e474e158.tar.bz2
solaris and stability patches provided by Juergen Keil
CVS patchset: 211 CVS date: 2001/06/21 17:34:23
-rw-r--r--AUTHORS3
-rw-r--r--acconfig.h9
-rw-r--r--configure.in69
-rw-r--r--doc/README9
-rw-r--r--doc/README.solaris8
-rw-r--r--m4/_xine.m42
-rwxr-xr-xmisc/autogen.sh19
-rw-r--r--src/audio_out/Makefile.am20
-rw-r--r--src/audio_out/audio_sun_out.c470
-rw-r--r--src/audio_out/audio_sun_out.h27
-rw-r--r--src/demuxers/demux_elem.c3
-rw-r--r--src/input/input_dvd.c17
-rw-r--r--src/input/input_file.c3
-rw-r--r--src/input/input_net.c5
-rw-r--r--src/input/input_rtp.c2
-rw-r--r--src/input/input_vcd.c284
-rw-r--r--src/libac3/bitstream.c10
-rw-r--r--src/libac3/bitstream.h5
-rw-r--r--src/libmpeg2/Makefile.am4
-rw-r--r--src/libw32dll/Makefile.am2
-rw-r--r--src/libw32dll/w32codec.c5
-rw-r--r--src/libw32dll/wine/Makefile.am6
-rw-r--r--src/libw32dll/wine/config.h442
-rw-r--r--src/libw32dll/wine/win32.c182
-rw-r--r--src/video_out/video_out_syncfb.c6
-rw-r--r--src/video_out/video_out_xshm.c45
-rw-r--r--src/video_out/yuv2rgb.c679
-rw-r--r--src/video_out/yuv2rgb.h14
-rw-r--r--src/video_out/yuv2rgb_mmx.c43
-rw-r--r--src/xine-engine/utils.c4
-rw-r--r--src/xine-engine/video_out.c20
-rw-r--r--src/xine-engine/xine.c4
32 files changed, 1672 insertions, 749 deletions
diff --git a/AUTHORS b/AUTHORS
index e56a2937d..cae3fb299 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -92,6 +92,9 @@ Contributions
James Courtier-Dutton <James@superbug.demon.co.uk>
AC3 direct out via spdif on oss
+ Juergen Keil <jk@tools.de>
+ solaris port and other bugfixes
+
(let us know if we've forgotten anyone)
diff --git a/acconfig.h b/acconfig.h
index 960362269..7e747e199 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -44,8 +44,17 @@
/* Define this if you have libaa installed */
#undef HAVE_AA
+/* Define this if you have a usable OSS soundinterface available */
+#undef HAVE_OSS
+
/* Define this if you have Alsa (libasound) installed */
#undef HAVE_ALSA
/* Define this if you have ESD (libesd) installed */
#undef HAVE_ESD
+
+/* Define this if you have a usable Sun sound interface available */
+#undef HAVE_SUNAUDIO
+
+/* Define this if you have kernel statistics available via kstat interface */
+#undef HAVE_KSTAT
diff --git a/configure.in b/configure.in
index b4c6d5c66..f7d954181 100644
--- a/configure.in
+++ b/configure.in
@@ -10,7 +10,7 @@ dnl
AC_PREREQ(2.13)
dnl
-dnl Require libtool minimum version 1.3.5
+dnl Require libtool minimum version 1.4.0
dnl
AC_PREREQ_LIBTOOL(1.4.0,,AC_MSG_ERROR(*** You should have libtool >= 1.4 installed ***))
@@ -142,7 +142,7 @@ AC_ARG_ENABLE(mlib,
enable_mlib=no, enable_mlib=yes)
fi
if test x$enable_mlib = xyes; then
- AC_CHECK_LIB(mlib, main,
+ AC_CHECK_LIB(mlib, mlib_VideoAddBlock_U8_S16,
[ LIBS="$LIBS -L/opt/SUNWmlib/lib -lmlib"
LIBMPEG2_CONFIG_OBJS="$LIBMPEG2_CONFIG_OBJS idct_mlib.lo motion_comp_mlib.lo"
LIBMPEG2_CFLAGS="$LIBMPEG2_CFLAGS -I/opt/SUNWmlib/include"
@@ -200,6 +200,27 @@ dnl
AM_PATH_AALIB(1.2,,)
AM_CONDITIONAL(HAVE_AA, test x$no_aalib != "xyes")
+
+dnl
+dnl OSS style audio interface
+dnl
+AC_MSG_CHECKING(for OSS audio support)
+have_ossaudio=no
+AC_TRY_COMPILE([
+ #ifdef __NetBSD__
+ #include <soundcard.h>
+ #else
+ #include <sys/soundcard.h>
+ #endif
+ ],[
+ int arg = SNDCTL_DSP_SETFRAGMENT;
+ ],[
+ have_ossaudio=yes
+ ])
+AC_MSG_RESULT($have_ossaudio)
+AM_CONDITIONAL(HAVE_OSS, test x"$have_ossaudio" = "xyes")
+
+
dnl
dnl Alsa support
dnl
@@ -219,10 +240,35 @@ AM_CONDITIONAL(HAVE_ESD, test x"$no_esd" != "xyes")
dnl
+dnl SUN style audio interface
+dnl
+AC_MSG_CHECKING(for Sun audio support)
+have_sunaudio=no
+AC_TRY_COMPILE([
+ #include <sys/types.h>
+ #include <sys/audioio.h>
+ ],[
+ audio_info_t audio_info;
+ AUDIO_INITINFO(&audio_info);
+ ],[
+ have_sunaudio=yes
+ ])
+AC_MSG_RESULT($have_sunaudio)
+AM_CONDITIONAL(HAVE_SUNAUDIO, test x"$have_sunaudio" = "xyes")
+
+dnl
+dnl Solaris kstat kernel statistics
+dnl
+AC_CHECK_LIB(kstat, kstat_open,
+ KSTAT_LIBS=-lkstat
+ AC_DEFINE(HAVE_KSTAT))
+AC_SUBST(KSTAT_LIBS)
+
+dnl
dnl Some extra checks.
dnl
-AC_CHECK_FUNC(getpwuid_r,AC_DEFINE(HAVE_GETPWUID_R))
-AC_CHECK_HEADERS(byteswap.h)
+AC_HAVE_FUNCS(sigaction sigset getpwuid_r)
+AC_CHECK_HEADERS(byteswap.h malloc.h sys/mman.h)
dnl
dnl check cflags not supported by all gcc versions
@@ -270,18 +316,19 @@ case $host in
dnl add x86 specific CFLAGS
GLOBAL_CFLAGS="$GLOBAL_CFLAGS -O3 -pipe -fomit-frame-pointer -malign-functions=4 -malign-loops=4 -malign-jumps=4 -malign-functions=4 $m_wm $m_psb -fexpensive-optimizations $f_si $f_nsa -ffast-math -funroll-loops -funroll-all-loops -finline-functions"
- DEBUG_CFLAGS="$DEBUG_CFLAGS -O3"
+ dnl DEBUG_CFLAGS="$DEBUG_CFLAGS -O3"
+ DEBUG_CFLAGS="$DEBUG_CFLAGS -O"
dnl enable x86 specific parts of the code
enable_w32dll="yes"
if test x"$sarchopt" != "xno"; then
[case "$host_alias" in
- i386-*) dnl *BSD return this even on a P III #-))
+ i386-*) # *BSD return this even on a P III #-))
GLOBAL_CFLAGS="$GLOBAL_CFLAGS $sarchopt=i386"
DEBUG_CFLAGS="$DEBUG_CFLAGS $sarchopt=i386"
;;
- i486-*) dnl oh dear!
+ i486-*) # oh dear!
GLOBAL_CFLAGS="$GLOBAL_CFLAGS $sarchopt=i486"
DEBUG_CFLAGS="$DEBUG_CFLAGS $sarchopt=i486"
;;
@@ -334,7 +381,7 @@ case $host in
;;
sparc-*)
GLOBAL_CFLAGS="$GLOBAL_CFLAGS -O3"
- DEBUG_CFLAGS="$DEBUG_CFLAGS -O3"
+ DEBUG_CFLAGS="$DEBUG_CFLAGS -O"
;;
*) echo "$host is not currently supported by xine"; exit 1;;
esac
@@ -412,7 +459,8 @@ AC_SUBST(INCLUDES)
dnl
dnl Get where .m4 should be installed.
dnl
-if test "`id -u`" = "0"; then
+case "`id`" in
+uid=0\(* )
AC_MSG_CHECKING(for aclocal directory)
if(aclocal --version) < /dev/null > /dev/null 2>&1; then
ACLOCAL_DIR=`$ACLOCAL --print-ac-dir`
@@ -422,7 +470,8 @@ if test "`id -u`" = "0"; then
AC_MSG_RESULT(none - will be installed in $ACLOCAL_DIR)
fi
AC_SUBST(ACLOCAL_DIR)
-fi
+ ;;
+esac
AM_CONDITIONAL(INSTALL_M4, test x"$ACLOCAL_DIR" != "x")
AC_CHECK_PROG(DOXYGEN, doxygen, doxygen, no)
diff --git a/doc/README b/doc/README
index a91890f28..7af89b377 100644
--- a/doc/README
+++ b/doc/README
@@ -75,9 +75,12 @@ xine has so far been sucessfully used on the following systems:
- Linux on a Amd K6-2@475
using XFree86 4.1.0 on a 3dfx voodoo3 2000 PCI 16Mb
(Xv is working on this configuration)
+- Solaris 8 on Intel
+ see READNE.solaris for more infomation
-Work for non-Intel platforms has started but has not yet reached a
-working state.
+non-intel platforms:
+- Solaris 8 on SPARC
+ see READNE.solaris for more infomation
usage:
------
@@ -335,4 +338,4 @@ contacting the xine project:
Daniel Caujolle-Bert <f1rmb@users.sourceforge.net>
Siegfried Langauf <siggi@users.sourceforge.net>
- $Id: README,v 1.2 2001/06/17 01:22:08 guenter Exp $
+ $Id: README,v 1.3 2001/06/21 17:34:23 guenter Exp $
diff --git a/doc/README.solaris b/doc/README.solaris
new file mode 100644
index 000000000..c5f08575c
--- /dev/null
+++ b/doc/README.solaris
@@ -0,0 +1,8 @@
+building xine on solaris
+------------------------
+
+Compile xine with GNU make (gmake, /opt/sfw/bin/gmake)
+
+If you get a "fatal: relocation error" ... "symbol __divdi3:
+referenced symbol not found" error when running xine, re-configure
+xine-lib with gcc as the linker command (env LD=gcc configure ...)
diff --git a/m4/_xine.m4 b/m4/_xine.m4
index 7f0c72e58..745453e41 100644
--- a/m4/_xine.m4
+++ b/m4/_xine.m4
@@ -8,7 +8,7 @@ AC_DEFUN([AC_PREREQ_LIBTOOL],
AC_MSG_CHECKING(for libtool >= $lt_min_full)
lpwd="`pwd`"
lt_pathname="`echo $lpwd/ltmain.sh | sed -e 's/\=build\///g'`"
- lt_version="`grep ^VERSION $lt_pathname | sed -e 's/\.//g;s/VERSION\=//g;s/[a-zA-Z]//g;s/-//g'`"
+ lt_version="`grep '^VERSION' $lt_pathname | sed -e 's/\.//g;s/VERSION\=//g;s/[a-zA-Z]//g;s/-//g'`"
if test $lt_version -lt 100; then
lt_version=`expr $lt_version \* 10`
diff --git a/misc/autogen.sh b/misc/autogen.sh
index f988e5950..4066b34cd 100755
--- a/misc/autogen.sh
+++ b/misc/autogen.sh
@@ -7,6 +7,13 @@ DIE=0
PROG=xine-lib
+# Check how echo works in this /bin/sh
+case `echo -n` in
+-n) _echo_n= _echo_c='\c';;
+*) _echo_n=-n _echo_c=;;
+esac
+
+
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "You must have autoconf installed to compile $PROG."
@@ -18,7 +25,7 @@ PROG=xine-lib
(libtool --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "You must have libtool installed to compile $PROG."
- echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2.tar.gz"
+ echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.4.tar.gz"
echo "(or a newer version if it is available)"
DIE=1
}
@@ -45,19 +52,19 @@ if [ "$DIE" -eq 1 ]; then
fi
aclocalinclude="$ACLOCAL_FLAGS"; \
-(echo -n " + Running aclocal: "; \
+(echo $_echo_n " + Running aclocal: $_echo_c"; \
aclocal $aclocalinclude; \
echo "done.") && \
-(echo -n " + Running libtoolize: "; \
+(echo $_echo_n " + Running libtoolize: $_echo_c"; \
libtoolize --force >/dev/null 2>&1; \
echo "done.") && \
-(echo -n " + Running autoheader: "; \
+(echo $_echo_n " + Running autoheader: $_echo_c"; \
autoheader; \
echo "done.") && \
-(echo -n " + Running automake: "; \
+(echo $_echo_n " + Running automake: $_echo_c"; \
automake --gnu --add-missing; \
echo "done.") && \
-(echo -n " + Running autoconf: "; \
+(echo $_echo_n " + Running autoconf: $_echo_c"; \
autoconf; \
echo "done.")
diff --git a/src/audio_out/Makefile.am b/src/audio_out/Makefile.am
index 28b7dfc5d..aac9ec194 100644
--- a/src/audio_out/Makefile.am
+++ b/src/audio_out/Makefile.am
@@ -1,11 +1,15 @@
CFLAGS = @GLOBAL_CFLAGS@ -DXINE_COMPILE $(ALSA_CFLAGS) $(ESD_CFLAGS)
-EXTRA_DIST = audio_alsa_out.c audio_alsa05_out.c audio_esd_out.c
+EXTRA_DIST = audio_alsa_out.c audio_alsa05_out.c audio_esd_out.c audio_sun_out.c
LIBTOOL = $(SHELL) $(top_builddir)/libtool-nofpic
libdir = $(XINE_PLUGINDIR)
+if HAVE_OSS
+oss_module = xineplug_ao_out_oss.la
+endif
+
#
# alsa plugin is completely broken due to major api change
# on the alsa project side
@@ -18,14 +22,18 @@ if HAVE_ESD
esd_module = xineplug_ao_out_esd.la
endif
+if HAVE_SUNAUDIO
+sun_module = xineplug_ao_out_sun.la
+endif
+
##
# IMPORTANT:
# ---------
# All of xine audio out plugins should be named like the
# scheme "xineplug_ao_out_"
#
-#lib_LTLIBRARIES = xineplug_ao_out_oss.la $(alsa_module) $(esd_module)
-lib_LTLIBRARIES = xineplug_ao_out_oss.la $(alsa_module)
+#lib_LTLIBRARIES = $(oss_module) $(alsa_module) $(sun_module) $(esd_module)
+lib_LTLIBRARIES = $(oss_module) $(alsa_module) $(sun_module) #$(esd_module)
xineplug_ao_out_oss_la_SOURCES = audio_oss_out.c resample.c
xineplug_ao_out_oss_la_LDFLAGS = -avoid-version -module
@@ -39,7 +47,11 @@ xineplug_ao_out_alsa_la_LDFLAGS = -avoid-version -module
#xineplug_ao_out_esd_la_LIBADD = $(ESD_LIBS)
#xineplug_ao_out_esd_la_LDFLAGS = -avoid-version -module
-noinst_HEADERS = audio_oss_out.h audio_alsa_out.h audio_esd_out.h resample.h
+xineplug_ao_out_sun_la_SOURCES = audio_sun_out.c resample.c
+xineplug_ao_out_sun_la_LDFLAGS = -avoid-version -module
+
+noinst_HEADERS = audio_oss_out.h audio_alsa_out.h audio_esd_out.h \
+ audio_sun_out.h resample.h
debug:
diff --git a/src/audio_out/audio_sun_out.c b/src/audio_out/audio_sun_out.c
new file mode 100644
index 000000000..0d006bbc8
--- /dev/null
+++ b/src/audio_out/audio_sun_out.c
@@ -0,0 +1,470 @@
+/*
+ * Copyright (C) 2001 the xine project
+ *
+ * This file is part of xine, a unix video player.
+ *
+ * xine is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * xine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * $Id: audio_sun_out.c,v 1.1 2001/06/21 17:34:23 guenter Exp $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <math.h>
+#include <unistd.h>
+#include <sys/audioio.h>
+#include <sys/ioctl.h>
+#include <inttypes.h>
+
+#include "xine_internal.h"
+#include "monitor.h"
+#include "audio_out.h"
+#include "resample.h"
+#include "metronom.h"
+#include "utils.h"
+
+
+#define GAP_TOLERANCE 5000
+
+
+typedef struct sun_functions_s {
+
+ ao_functions_t ao_functions;
+
+ metronom_t *metronom;
+
+ char *audio_dev;
+ int audio_fd;
+ int capabilities;
+ int mode;
+
+ int32_t output_sample_rate, input_sample_rate;
+ double sample_rate_factor;
+ uint32_t num_channels;
+
+ uint32_t bytes_in_buffer; /* number of bytes writen to audio hardware */
+
+ int audio_step; /* pts per 32 768 samples (sample = #bytes/2) */
+ int32_t bytes_per_kpts; /* bytes per 1024/90000 sec */
+
+ int16_t *zero_space;
+
+ int audio_started;
+
+} sun_functions_t;
+
+/*
+ * open the audio device for writing to
+ */
+static int ao_open(ao_functions_t *this_gen,
+ uint32_t bits, uint32_t rate, int mode)
+{
+ sun_functions_t *this = (sun_functions_t *) this_gen;
+ audio_info_t info;
+
+ printf ("audio_sun_out: ao_open rate=%d, mode=%d\n", rate, mode);
+
+ if ( (mode & this->capabilities) == 0 ) {
+ printf ("audio_sun_out: unsupported mode %08x\n", mode);
+ return -1;
+ }
+
+ if (this->audio_fd > -1) {
+
+ if ( (mode == this->mode) && (rate == this->input_sample_rate) )
+ return 1;
+
+ close (this->audio_fd);
+ }
+
+ this->mode = mode;
+ this->input_sample_rate = rate;
+ this->bytes_in_buffer = 0;
+ this->audio_started = 0;
+
+ /*
+ * open audio device
+ */
+
+ this->audio_fd=open(this->audio_dev,O_WRONLY|O_NDELAY);
+ if(this->audio_fd < 0) {
+ printf("audio_sun_out: Opening audio device %s: %s\n",
+ this->audio_dev, strerror(errno));
+ return -1;
+ }
+
+ /* We wanted non blocking open but now put it back to normal */
+ fcntl(this->audio_fd, F_SETFL, fcntl(this->audio_fd, F_GETFL)&~O_NDELAY);
+
+ /*
+ * configure audio device
+ */
+
+ AUDIO_INITINFO(&info);
+ info.play.channels = (mode & AO_CAP_MODE_STEREO)
+ ? AUDIO_CHANNELS_STEREO
+ : AUDIO_CHANNELS_MONO;
+ info.play.precision = bits;
+ info.play.encoding = AUDIO_ENCODING_LINEAR;
+ info.play.sample_rate = this->input_sample_rate;
+ info.play.eof = 0;
+ info.play.samples = 0;
+
+ ioctl(this->audio_fd, AUDIO_SETINFO, &info);
+
+ this->output_sample_rate = info.play.sample_rate;
+ this->num_channels = info.play.channels;
+
+ xprintf (VERBOSE|AUDIO, "audio_sun_out: audio rate : %d requested, %d provided by device/sec\n",
+ this->input_sample_rate, this->output_sample_rate);
+
+ printf ("audio_sun_out : %d channels output\n",this->num_channels);
+
+ this->sample_rate_factor = (double) this->output_sample_rate / (double) this->input_sample_rate;
+ this->audio_step = (uint32_t) 90000 * (uint32_t) 32768
+ / this->input_sample_rate;
+ this->bytes_per_kpts = this->output_sample_rate * this->num_channels * 2 * 1024 / 90000;
+
+ xprintf (VERBOSE|AUDIO, "audio_out : audio_step %d pts per 32768 samples\n", this->audio_step);
+ printf ("audio_out : audio_step %d pts per 32768 samples\n", this->audio_step);
+
+ this->metronom->set_audio_rate(this->metronom, this->audio_step);
+
+ return 1;
+}
+
+static void ao_fill_gap (sun_functions_t *this, uint32_t pts_len) {
+
+ int num_bytes = pts_len * this->bytes_per_kpts / 1024;
+ num_bytes = (num_bytes / (2*this->num_channels)) * (2*this->num_channels);
+ if(this->mode == AO_CAP_MODE_AC3) return;
+ printf ("audio_sun_out: inserting %d 0-bytes to fill a gap of %d pts\n",num_bytes, pts_len);
+
+ this->bytes_in_buffer += num_bytes;
+
+ while (num_bytes>0) {
+ if (num_bytes>8192) {
+ write(this->audio_fd, this->zero_space, 8192);
+ num_bytes -= 8192;
+ } else {
+ write(this->audio_fd, this->zero_space, num_bytes);
+ num_bytes = 0;
+ }
+ }
+}
+
+static void ao_write_audio_data(ao_functions_t *this_gen,
+ int16_t* output_samples, uint32_t num_samples,
+ uint32_t pts_)
+{
+
+ sun_functions_t *this = (sun_functions_t *) this_gen;
+ uint32_t vpts, buffer_vpts;
+ int32_t gap;
+ int bDropPackage;
+ uint16_t sample_buffer[10000];
+ int pos;
+ audio_info_t info;
+
+ if (this->audio_fd<0)
+ return;
+
+ vpts = this->metronom->got_audio_samples (this->metronom, pts_, num_samples);
+
+ xprintf (VERBOSE|AUDIO, "audio_sun_out: got %d samples, vpts=%d\n",
+ num_samples, vpts);
+
+ /*
+ * where, in the timeline is the "end" of the audio buffer at the moment?
+ */
+
+ buffer_vpts = this->metronom->get_current_time (this->metronom);
+
+ if (this->audio_started) {
+ ioctl (this->audio_fd, AUDIO_GETINFO, &info);
+ pos = info.play.samples * 2 * this->num_channels;
+ } else
+ pos = 0;
+
+ if (pos>this->bytes_in_buffer) /* buffer ran dry */
+ this->bytes_in_buffer = pos;
+
+ buffer_vpts += (this->bytes_in_buffer - pos) * 1024 / this->bytes_per_kpts;
+
+ /*
+ printf ("audio_sun_out: got audio package vpts = %d, buffer_vpts = %d\n",
+ vpts, buffer_vpts);
+ */
+
+ /*
+ * calculate gap:
+ */
+
+ gap = vpts - buffer_vpts;
+
+ bDropPackage = 0;
+
+ if (gap>GAP_TOLERANCE) {
+ ao_fill_gap (this, gap);
+ } else if (gap<-GAP_TOLERANCE) {
+ bDropPackage = 1;
+ }
+
+ /*
+ * resample and output samples
+ */
+
+ /*
+ if(this->mode == AO_CAP_MODE_AC3) bDropPackage=0;
+ */
+
+ if (!bDropPackage) {
+ int num_output_samples = num_samples * (this->output_sample_rate) / this->input_sample_rate;
+
+ switch (this->mode) {
+ case AO_CAP_MODE_MONO:
+ audio_out_resample_mono (output_samples, num_samples,
+ sample_buffer, num_output_samples);
+ write(this->audio_fd, sample_buffer, num_output_samples * 2);
+ break;
+ case AO_CAP_MODE_STEREO:
+ audio_out_resample_stereo (output_samples, num_samples,
+ sample_buffer, num_output_samples);
+ write(this->audio_fd, sample_buffer, num_output_samples * 4);
+ break;
+ /*
+ case AO_CAP_MODE_4CHANNEL:
+ audio_out_resample_4channel (output_samples, num_samples,
+ sample_buffer, num_output_samples);
+ write(this->audio_fd, sample_buffer, num_output_samples * 8);
+ break;
+ case AO_CAP_MODE_5CHANNEL:
+ audio_out_resample_5channel (output_samples, num_samples,
+ sample_buffer, num_output_samples);
+ write(this->audio_fd, sample_buffer, num_output_samples * 10);
+ break;
+ case AO_CAP_MODE_AC3:
+ num_output_samples = num_samples+8;
+ sample_buffer[0] = 0xf872; //spdif syncword
+ sample_buffer[1] = 0x4e1f; // .............
+ sample_buffer[2] = 0x0001; // AC3 data
+ sample_buffer[3] = num_samples * 8;
+// sample_buffer[4] = 0x0b77; // AC3 syncwork already in output_samples
+
+ // ac3 seems to be swabbed data
+ swab(output_samples,sample_buffer+4, num_samples );
+ write(this->audio_fd, sample_buffer, num_output_samples);
+ write(this->audio_fd, this->zero_space, 6144-num_output_samples);
+ num_output_samples=num_output_samples/4;
+ break;
+ */
+ default:
+ fprintf(stderr, "audio_sun_out: unsupported audio mode %d\n", this->mode);
+ break;
+ }
+
+ xprintf (AUDIO|VERBOSE, "audio_sun_out :audio package written\n");
+
+ /*
+ * step values
+ */
+
+ this->bytes_in_buffer += num_output_samples * 2 * this->num_channels;
+ this->audio_started = 1;
+ } else {
+ printf ("audio_sun_out: audio package (vpts = %d) dropped\n", vpts);
+ }
+}
+
+
+static void ao_close(ao_functions_t *this_gen)
+{
+ sun_functions_t *this = (sun_functions_t *) this_gen;
+ close(this->audio_fd);
+ this->audio_fd = -1;
+}
+
+static uint32_t ao_get_capabilities (ao_functions_t *this_gen) {
+ sun_functions_t *this = (sun_functions_t *) this_gen;
+ return this->capabilities;
+}
+
+static void ao_connect (ao_functions_t *this_gen, metronom_t *metronom) {
+ sun_functions_t *this = (sun_functions_t *) this_gen;
+
+ this->metronom = metronom;
+}
+
+static void ao_exit(ao_functions_t *this_gen)
+{
+ sun_functions_t *this = (sun_functions_t *) this_gen;
+
+ if (this->audio_fd != -1)
+ close(this->audio_fd);
+
+ free (this->zero_space);
+ free (this);
+}
+
+/*
+ * Get a property of audio driver.
+ * return 1 in success, 0 on failure. (and the property value?)
+ */
+static int ao_get_property (ao_functions_t *this_gen, int property) {
+ sun_functions_t *this = (sun_functions_t *) this_gen;
+ audio_info_t info;
+
+ switch(property) {
+ case AO_PROP_MIXER_VOL:
+ break;
+ case AO_PROP_PCM_VOL:
+ if (ioctl(this->audio_fd, AUDIO_GETINFO, &info) < 0)
+ return 0;
+ return info.play.gain;
+ case AO_PROP_MUTE_VOL:
+ if (ioctl(this->audio_fd, AUDIO_GETINFO, &info) < 0)
+ return 0;
+ return info.output_muted;
+ }
+
+ return 0;
+}
+
+/*
+ * Set a property of audio driver.
+ * return value on success, ~value on failure
+ */
+static int ao_set_property (ao_functions_t *this_gen, int property, int value) {
+ sun_functions_t *this = (sun_functions_t *) this_gen;
+ audio_info_t info;
+
+ AUDIO_INITINFO(&info);
+
+ switch(property) {
+ case AO_PROP_MIXER_VOL:
+ break;
+ case AO_PROP_PCM_VOL:
+ info.play.gain = value;
+ if (ioctl(this->audio_fd, AUDIO_SETINFO, &info) < 0)
+ return ~value;
+ return value;
+ case AO_PROP_MUTE_VOL:
+ info.output_muted = value != 0;
+ if (ioctl(this->audio_fd, AUDIO_SETINFO, &info) < 0)
+ return ~value;
+ return value;
+ }
+
+ return ~value;
+}
+
+ao_functions_t *init_audio_out_plugin (config_values_t *config) {
+
+ sun_functions_t *this;
+ char *devname = "/dev/audio";
+ int audio_fd;
+ int status;
+ audio_info_t info;
+
+ this = (sun_functions_t *) malloc (sizeof (sun_functions_t));
+
+ /*
+ * find best device driver/channel
+ */
+
+ printf ("audio_sun_out: Opening audio device...\n");
+ xprintf (VERBOSE|AUDIO, "audio_sun_out: Opening audio device...");
+
+ /*
+ * open the device
+ */
+
+ audio_fd=open(this->audio_dev = devname, O_WRONLY|O_NDELAY);
+
+ if(audio_fd < 0)
+ {
+ printf("audio_sun_out: opening audio device %s failed:\n%s\n",
+ devname, strerror(errno));
+
+ free (this);
+ return NULL;
+
+ } else
+ xprintf (VERBOSE|AUDIO, " %s\n", devname);
+
+ /*
+ * set up driver to reasonable values for capabilities tests
+ */
+
+ AUDIO_INITINFO(&info);
+ info.play.encoding = AUDIO_ENCODING_LINEAR;
+ info.play.precision = AUDIO_PRECISION_16;
+ info.play.sample_rate = 44100;
+ status = ioctl(audio_fd, AUDIO_SETINFO, &info);
+
+ /*
+ * get capabilities
+ */
+
+ this->capabilities = 0;
+
+ printf ("audio_sun_out : supported modes are ");
+
+ this->capabilities |= AO_CAP_MODE_MONO;
+ printf ("mono ");
+
+ this->capabilities |= AO_CAP_MODE_STEREO;
+ printf ("stereo ");
+
+ this->capabilities |= AO_CAP_PCM_VOL | AO_CAP_MUTE_VOL;
+ printf ("\n");
+
+ close (audio_fd);
+
+ this->output_sample_rate = 0;
+
+ this->zero_space = malloc (8192);
+ memset (this->zero_space, 0, 8192);
+
+ this->ao_functions.get_capabilities = ao_get_capabilities;
+ this->ao_functions.get_property = ao_get_property;
+ this->ao_functions.set_property = ao_set_property;
+ this->ao_functions.connect = ao_connect;
+ this->ao_functions.open = ao_open;
+ this->ao_functions.write_audio_data = ao_write_audio_data;
+ this->ao_functions.close = ao_close;
+ this->ao_functions.exit = ao_exit;
+
+ return &this->ao_functions;
+}
+
+static ao_info_t ao_info_sun = {
+ AUDIO_OUT_IFACE_VERSION,
+ "sun",
+ "xine audio output plugin using sun-compliant audio devices/drivers",
+ 5
+};
+
+ao_info_t *get_audio_out_plugin_info() {
+ return &ao_info_sun;
+}
+
diff --git a/src/audio_out/audio_sun_out.h b/src/audio_out/audio_sun_out.h
new file mode 100644
index 000000000..aa1fa87f0
--- /dev/null
+++ b/src/audio_out/audio_sun_out.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2000 the xine project
+ *
+ * This file is part of xine, a unix video player.
+ *
+ * xine is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * xine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * $Id: audio_sun_out.h,v 1.1 2001/06/21 17:34:23 guenter Exp $
+ */
+#ifndef _AUDIO_SUN_OUT_H_
+#define _AUDIO_SUN_OUT_H_ 1
+
+ao_functions_t *audio_sunout_init(void);
+
+#endif
diff --git a/src/demuxers/demux_elem.c b/src/demuxers/demux_elem.c
index 0eddb34cd..121d92bb0 100644
--- a/src/demuxers/demux_elem.c
+++ b/src/demuxers/demux_elem.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: demux_elem.c,v 1.12 2001/06/17 23:17:40 f1rmb Exp $
+ * $Id: demux_elem.c,v 1.13 2001/06/21 17:34:23 guenter Exp $
*
* demultiplexer for elementary mpeg streams
*
@@ -28,6 +28,7 @@
#endif
#include <stdio.h>
+#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <pthread.h>
diff --git a/src/input/input_dvd.c b/src/input/input_dvd.c
index b9ccda9cd..3c49e5948 100644
--- a/src/input/input_dvd.c
+++ b/src/input/input_dvd.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: input_dvd.c,v 1.9 2001/06/02 21:44:01 guenter Exp $
+ * $Id: input_dvd.c,v 1.10 2001/06/21 17:34:23 guenter Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -27,7 +27,8 @@
#include <dlfcn.h>
#include <stdio.h>
#include <fcntl.h>
-#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__)
+#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) \
+ || defined(__sun)
# include <sys/cdio.h>
#elif defined(__linux__)
#include <linux/config.h> /* Check for DEVFS */
@@ -49,6 +50,10 @@
static uint32_t xine_debug;
+#if defined(__sun)
+#define RDVD "/vol/dev/aliases/cdrom0"
+#define DVD RDVD
+#else
#ifdef CONFIG_DEVFS_FS
#define DVD "/dev/cdroms/dvd"
#define RDVD "/dev/cdroms/rdvd"
@@ -56,6 +61,7 @@ static uint32_t xine_debug;
#define DVD "/dev/dvd"
#define RDVD "/dev/rdvd"
#endif
+#endif
typedef struct {
@@ -375,6 +381,13 @@ static int dvd_plugin_eject_media (input_plugin_t *this_gen) {
}
}
+#elif defined(__sun)
+
+ status = 0;
+ if ((ret = ioctl(fd, CDROMEJECT)) != 0) {
+ xprintf(VERBOSE|INPUT, "CDROMEJECT failed: %s\n", strerror(errno));
+ }
+
#endif
close(fd);
diff --git a/src/input/input_file.c b/src/input/input_file.c
index 63c5b6b08..8b78365b0 100644
--- a/src/input/input_file.c
+++ b/src/input/input_file.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: input_file.c,v 1.11 2001/06/02 21:44:01 guenter Exp $
+ * $Id: input_file.c,v 1.12 2001/06/21 17:34:23 guenter Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -33,6 +33,7 @@
#include <fcntl.h>
#include <string.h>
#include <errno.h>
+#include <limits.h> /*PATH_MAX*/
#include "xine_internal.h"
#include "monitor.h"
diff --git a/src/input/input_net.c b/src/input/input_net.c
index ddd651053..df2ee9e83 100644
--- a/src/input/input_net.c
+++ b/src/input/input_net.c
@@ -41,6 +41,11 @@
#include "monitor.h"
#include "input_plugin.h"
+#if !defined(NDELAY) && defined(O_NDELAY)
+#define FNDELAY O_NDELAY
+#endif
+
+
static uint32_t xine_debug;
#define NET_BS_LEN 2324
diff --git a/src/input/input_rtp.c b/src/input/input_rtp.c
index c046e813b..f43c7cb6c 100644
--- a/src/input/input_rtp.c
+++ b/src/input/input_rtp.c
@@ -153,7 +153,7 @@ static int host_connect_attempt(struct in_addr ia, int port) {
mreqn.imr_multiaddr.s_addr = sin.sin_addr.s_addr;
mreqn.imr_address.s_addr = INADDR_ANY;
mreqn.imr_ifindex = 0;
-#elif defined (__FreeBSD__)
+#elif defined (__FreeBSD__) || defined(__sun)
struct ip_mreq mreqn;
mreqn.imr_multiaddr.s_addr = sin.sin_addr.s_addr;
diff --git a/src/input/input_vcd.c b/src/input/input_vcd.c
index 4c5ff0029..36a32bb19 100644
--- a/src/input/input_vcd.c
+++ b/src/input/input_vcd.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: input_vcd.c,v 1.9 2001/06/09 11:39:20 heikos Exp $
+ * $Id: input_vcd.c,v 1.10 2001/06/21 17:34:23 guenter Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -38,6 +38,8 @@
#elif defined (__FreeBSD__)
#include <sys/cdio.h>
#include <sys/cdrio.h>
+#elif defined (__sun)
+#include <sys/cdio.h>
#else
#error "you need to add cdrom / VCD support for your platform to input_vcd"
#endif
@@ -48,14 +50,26 @@
static uint32_t xine_debug;
+#if defined(__sun)
+#define CDROM "/vol/dev/aliases/cdrom0"
+#else
/* for FreeBSD make a link to the right devnode, like /dev/acd0c */
#ifdef CONFIG_DEVFS_FS
#define CDROM "/dev/cdroms/cdrom"
#else
#define CDROM "/dev/cdrom"
#endif
+#endif
#define VCDSECTORSIZE 2324
+#if defined (__sun)
+struct cdrom_msf0 {
+ unsigned char minute;
+ unsigned char second;
+ unsigned char frame;
+};
+#endif
+
typedef struct {
uint8_t sync [12];
uint8_t header [4];
@@ -73,7 +87,7 @@ typedef struct {
int fd;
-#if defined (__linux__)
+#if defined (__linux__) || defined(__sun)
struct cdrom_tochdr tochdr;
struct cdrom_tocentry tocent[100];
#elif defined (__FreeBSD__)
@@ -84,7 +98,7 @@ typedef struct {
int total_tracks;
int cur_track;
-#if defined (__linux__)
+#if defined (__linux__) || defined(__sun)
uint8_t cur_min, cur_sec, cur_frame;
#endif
@@ -93,13 +107,16 @@ typedef struct {
mrl_t *mrls[100];
int mrls_allocated_entries;
+#if defined(__sun)
+ int controller_type;
+#endif
} vcd_input_plugin_t;
/* ***************************************************************** */
/* Private functions */
/* ***************************************************************** */
-#if defined (__linux__)
+#if defined (__linux__) || defined(__sun)
static int input_vcd_read_toc (vcd_input_plugin_t *this) {
int i;
@@ -114,7 +131,7 @@ static int input_vcd_read_toc (vcd_input_plugin_t *this) {
this->tocent[i-1].cdte_track = i;
this->tocent[i-1].cdte_format = CDROM_MSF;
if ( ioctl(this->fd, CDROMREADTOCENTRY, &this->tocent[i-1]) == -1 ) {
- fprintf (stderr, "input_vcd: error in ioctl CDROMREADTOCENTRY\n");
+ fprintf (stderr, "input_vcd: error in ioctl CDROMREADTOCENTRY for track %d\n", i);
return -1;
}
}
@@ -125,7 +142,7 @@ static int input_vcd_read_toc (vcd_input_plugin_t *this) {
if (ioctl(this->fd, CDROMREADTOCENTRY,
&this->tocent[this->tochdr.cdth_trk1]) == -1 ) {
- fprintf (stderr, "input_vcd: error in ioctl CDROMREADTOCENTRY\n");
+ fprintf (stderr, "input_vcd: error in ioctl CDROMREADTOCENTRY for lead-out\n");
return -1;
}
@@ -166,6 +183,123 @@ static int input_vcd_read_toc (vcd_input_plugin_t *this) {
return 0;
}
#endif
+
+#if defined(__sun)
+#include <sys/dkio.h>
+#include <sys/scsi/generic/commands.h>
+#include <sys/scsi/impl/uscsi.h>
+
+#define SUN_CTRL_SCSI 1
+#define SUN_CTRL_ATAPI 2
+
+static int sun_vcd_read(vcd_input_plugin_t *this, long lba, cdsector_t *data)
+{
+ struct dk_cinfo cinfo;
+
+ /*
+ * CDROMCDXA/CDROMREADMODE2 are broken on IDE/ATAPI devices.
+ * Try to send MMC3 SCSI commands via the uscsi interface on
+ * ATAPI devices.
+ */
+ if (this->controller_type == 0) {
+ if (ioctl(this->fd, DKIOCINFO, &cinfo) == 0
+ && strcmp(cinfo.dki_cname, "ide") == 0)
+ this->controller_type = SUN_CTRL_ATAPI;
+ else
+ this->controller_type = SUN_CTRL_SCSI;
+ }
+ switch (this->controller_type) {
+ case SUN_CTRL_SCSI:
+#if 0
+ {
+ struct cdrom_cdxa cdxa;
+ cdxa.cdxa_addr = lba;
+ cdxa.cdxa_length = 1;
+ cdxa.cdxa_data = data->subheader;
+ cdxa.cdxa_format = CDROM_XA_SECTOR_DATA;
+
+ if(ioctl(this->fd,CDROMCDXA,&cdxa)==-1) {
+ perror("CDROMCDXA");
+ return -1;
+ }
+ }
+#else
+ {
+ struct cdrom_read cdread;
+ cdread.cdread_lba = 4*lba;
+ cdread.cdread_bufaddr = data->subheader;
+ cdread.cdread_buflen = 2336;
+
+ if(ioctl(this->fd,CDROMREADMODE2,&cdread)==-1) {
+ perror("CDROMREADMODE2");
+ return -1;
+ }
+ }
+#endif
+ break;
+
+ case SUN_CTRL_ATAPI:
+ {
+ struct uscsi_cmd sc;
+ union scsi_cdb cdb;
+ int blocks = 1;
+ int sector_type;
+ int sync, header_code, user_data, edc_ecc, error_field;
+ int sub_channel;
+
+ sector_type = 0; /* all types */
+ /*sector_type = 1;*/ /* CD-DA */
+ /*sector_type = 2;*/ /* mode1 */
+ /*sector_type = 3;*/ /* mode2 */
+ /*sector_type = 4;*/ /* mode2/form1 */
+ /*sector_type = 5;*/ /* mode2/form2 */
+ sync = 0;
+ header_code = 2;
+ user_data = 1;
+ edc_ecc = 0;
+ error_field = 0;
+ sub_channel = 0;
+
+ memset(data, 0xaa, sizeof(cdsector_t));
+
+ memset(&cdb, 0, sizeof(cdb));
+ memset(&sc, 0, sizeof(sc));
+ cdb.scc_cmd = 0xBE;
+ cdb.cdb_opaque[1] = (sector_type) << 2;
+ cdb.cdb_opaque[2] = (lba >> 24) & 0xff;
+ cdb.cdb_opaque[3] = (lba >> 16) & 0xff;
+ cdb.cdb_opaque[4] = (lba >> 8) & 0xff;
+ cdb.cdb_opaque[5] = lba & 0xff;
+ cdb.cdb_opaque[6] = (blocks >> 16) & 0xff;
+ cdb.cdb_opaque[7] = (blocks >> 8) & 0xff;
+ cdb.cdb_opaque[8] = blocks & 0xff;
+ cdb.cdb_opaque[9] = (sync << 7) |
+ (header_code << 5) |
+ (user_data << 4) |
+ (edc_ecc << 3) |
+ (error_field << 1);
+ cdb.cdb_opaque[10] = sub_channel;
+
+ sc.uscsi_cdb = (caddr_t)&cdb;
+ sc.uscsi_cdblen = 12;
+ sc.uscsi_bufaddr = data->subheader;
+ sc.uscsi_buflen = 2340;
+ sc.uscsi_flags = USCSI_ISOLATE | USCSI_READ;
+ sc.uscsi_timeout = 20;
+ if (ioctl(this->fd, USCSICMD, &sc)) {
+ perror("USCSICMD: READ CD");
+ return -1;
+ }
+ if (sc.uscsi_status) {
+ fprintf(stderr, "scsi command failed with status %d\n", sc.uscsi_status);
+ return -1;
+ }
+ }
+ break;
+ }
+ return 1;
+}
+#endif /*__sun*/
/* ***************************************************************** */
/* END OF PRIVATES */
/* ***************************************************************** */
@@ -214,7 +348,7 @@ static int vcd_plugin_open (input_plugin_t *this_gen, char *mrl) {
return 0;
}
-#if defined (__linux__)
+#if defined (__linux__) || defined(__sun)
this->cur_min = this->tocent[this->cur_track].cdte_addr.msf.minute;
this->cur_sec = this->tocent[this->cur_track].cdte_addr.msf.second;
this->cur_frame = this->tocent[this->cur_track].cdte_addr.msf.frame;
@@ -319,6 +453,57 @@ static off_t vcd_plugin_read (input_plugin_t *this_gen,
memcpy (buf, data.data, VCDSECTORSIZE);
return VCDSECTORSIZE;
}
+#elif defined (__sun)
+static off_t vcd_plugin_read (input_plugin_t *this_gen,
+ char *buf, off_t nlen) {
+
+ vcd_input_plugin_t *this = (vcd_input_plugin_t *) this_gen;
+ static cdsector_t data;
+ struct cdrom_msf0 *end_msf;
+ long lba;
+
+ if (nlen != VCDSECTORSIZE)
+ return 0;
+
+ do
+ {
+ end_msf = &this->tocent[this->cur_track+1].cdte_addr.msf;
+
+ /*
+ printf ("cur: %02d:%02d:%02d end: %02d:%02d:%02d\n",
+ this->cur_min, this->cur_sec, this->cur_frame,
+ end_msf->minute, end_msf->second, end_msf->frame);
+ */
+
+ if ( (this->cur_min>=end_msf->minute) && (this->cur_sec>=end_msf->second)
+ && (this->cur_frame>=end_msf->frame))
+ return 0;
+
+ lba = (this->cur_min * 60 + this->cur_sec) * 75L + this->cur_frame;
+
+ if (sun_vcd_read(this, lba, &data) < 0) {
+ fprintf(stderr, "input_vcd: read data failed\n");
+ return 0;
+ }
+
+ this->cur_frame++;
+ if (this->cur_frame>=75) {
+ this->cur_frame = 0;
+ this->cur_sec++;
+ if (this->cur_sec>=60) {
+ this->cur_sec = 0;
+ this->cur_min++;
+ }
+ }
+
+ /* Header ID check for padding sector. VCD uses this to keep constant
+ bitrate so the CD doesn't stop/start */
+ }
+ while((data.subheader[2]&~0x01)==0x60);
+
+ memcpy (buf, data.data, VCDSECTORSIZE); /* FIXME */
+ return VCDSECTORSIZE;
+}
#endif
/*
@@ -410,6 +595,60 @@ static buf_element_t *vcd_plugin_read_block (input_plugin_t *this_gen,
memcpy (buf->mem, data.data, VCDSECTORSIZE);
return buf;
}
+#elif defined(__sun)
+static buf_element_t *vcd_plugin_read_block (input_plugin_t *this_gen,
+ fifo_buffer_t *fifo, off_t nlen) {
+
+ vcd_input_plugin_t *this = (vcd_input_plugin_t *) this_gen;
+ buf_element_t *buf = fifo->buffer_pool_alloc (fifo);
+ static cdsector_t data;
+ struct cdrom_msf0 *end_msf;
+ long lba;
+
+ if (nlen != VCDSECTORSIZE)
+ return NULL;
+
+ do
+ {
+ end_msf = &this->tocent[this->cur_track+1].cdte_addr.msf;
+
+ /*
+ printf ("cur: %02d:%02d:%02d end: %02d:%02d:%02d\n",
+ this->cur_min, this->cur_sec, this->cur_frame,
+ end_msf->minute, end_msf->second, end_msf->frame);
+ */
+
+ if ( (this->cur_min>=end_msf->minute) && (this->cur_sec>=end_msf->second)
+ && (this->cur_frame>=end_msf->frame))
+ return NULL;
+
+ lba = (this->cur_min * 60 + this->cur_sec) * 75L + this->cur_frame;
+
+ if (sun_vcd_read (this, lba, &data) < 0) {
+ fprintf (stderr, "input_vcd: read data failed\n");
+ return NULL;
+ }
+
+
+ this->cur_frame++;
+ if (this->cur_frame>=75) {
+ this->cur_frame = 0;
+ this->cur_sec++;
+ if (this->cur_sec>=60) {
+ this->cur_sec = 0;
+ this->cur_min++;
+ }
+ }
+
+ /* Header ID check for padding sector. VCD uses this to keep constant
+ bitrate so the CD doesn't stop/start */
+ }
+ while((data.subheader[2]&~0x01)==0x60);
+
+ buf->content = buf->mem;
+ memcpy (buf->mem, data.data, VCDSECTORSIZE); /* FIXME */
+ return buf;
+}
#endif
//
@@ -417,7 +656,7 @@ static buf_element_t *vcd_plugin_read_block (input_plugin_t *this_gen,
/*
*
*/
-#if defined (__linux__)
+#if defined (__linux__) || defined(__sun)
static off_t vcd_plugin_seek (input_plugin_t *this_gen,
off_t offset, int origin) {
@@ -516,7 +755,7 @@ static off_t vcd_plugin_seek (input_plugin_t *this_gen,
/*
*
*/
-#if defined (__linux__)
+#if defined (__linux__) || defined(__sun)
static off_t vcd_plugin_get_length (input_plugin_t *this_gen) {
vcd_input_plugin_t *this = (vcd_input_plugin_t *) this_gen;
struct cdrom_msf0 *end_msf, *start_msf;
@@ -636,6 +875,19 @@ static int vcd_plugin_eject_media (input_plugin_t *this_gen) {
return 1;
}
+#elif defined (__sun)
+static int vcd_plugin_eject_media (input_plugin_t *this_gen) {
+ int fd, ret;
+
+ if ((fd = open(CDROM, O_RDONLY|O_NONBLOCK)) > -1) {
+ if ((ret = ioctl(fd, CDROMEJECT)) != 0) {
+ xprintf(VERBOSE|INPUT, "CDROMEJECT failed: %s\n", strerror(errno));
+ }
+ close(fd);
+ }
+
+ return 1;
+}
#endif
/*
@@ -681,11 +933,7 @@ static mrl_t **vcd_plugin_get_dir (input_plugin_t *this_gen,
this->fd = open (CDROM, O_RDONLY);
if (this->fd == -1) {
-#ifdef CONFIG_DEVFS_FS
- perror ("unable to open /dev/cdroms/cdrom");
-#else
- perror ("unable to open /dev/cdrom");
-#endif
+ perror ("unable to open " CDROM);
return NULL;
}
@@ -729,11 +977,7 @@ static char **vcd_plugin_get_autoplay_list (input_plugin_t *this_gen,
this->fd = open (CDROM, O_RDONLY);
if (this->fd == -1) {
-#ifdef CONFIG_DEVFS_FS
- perror ("unable to open /dev/cdroms/cdrom");
-#else
- perror ("unable to open /dev/cdrom");
-#endif
+ perror ("unable to open " CDROM);
return NULL;
}
@@ -793,7 +1037,7 @@ input_plugin_t *init_input_plugin (int iface, config_values_t *config) {
case 1: {
int i;
- this = (vcd_input_plugin_t *) malloc (sizeof (vcd_input_plugin_t));
+ this = (vcd_input_plugin_t *) calloc (1, sizeof (vcd_input_plugin_t));
for (i = 0; i < 100; i++) {
this->filelist[i] = (char *) malloc (256);
diff --git a/src/libac3/bitstream.c b/src/libac3/bitstream.c
index 8d771965e..1f4aff54e 100644
--- a/src/libac3/bitstream.c
+++ b/src/libac3/bitstream.c
@@ -44,8 +44,18 @@ void bitstream_set_ptr (uint8_t * buf)
static inline void
bitstream_fill_current()
{
+#ifdef __sparc__
+#warning FIXME: cannot access unaligned pointer on sparc
+ current_word =
+ (buffer_start[0] << 24) |
+ (buffer_start[1] << 16) |
+ (buffer_start[2] << 8) |
+ buffer_start[3];
+ buffer_start += 4;
+#else
current_word = *((uint32_t*)buffer_start)++;
current_word = swab32(current_word);
+#endif
}
//
diff --git a/src/libac3/bitstream.h b/src/libac3/bitstream.h
index 84f3287c8..b5d896184 100644
--- a/src/libac3/bitstream.h
+++ b/src/libac3/bitstream.h
@@ -21,6 +21,11 @@
*
*/
+#warning FIXME: need WORDS_BIGENDIAN autoconf test
+#ifdef __sparc__
+#define WORDS_BIGENDIAN 1
+#endif
+
//My new and improved vego-matic endian swapping routine
//(stolen from the kernel)
#ifdef WORDS_BIGENDIAN
diff --git a/src/libmpeg2/Makefile.am b/src/libmpeg2/Makefile.am
index 88d0d731e..e2d591ac6 100644
--- a/src/libmpeg2/Makefile.am
+++ b/src/libmpeg2/Makefile.am
@@ -1,4 +1,5 @@
CFLAGS = @LIBMPEG2_CFLAGS@ @GLOBAL_CFLAGS@
+DEBUG_CFLAGS = @LIBMPEG2_CFLAGS@ @DEBUG_CFLAGS@
EXTRA_DIST = idct_mlib.c idct_mlib.h motion_comp_mlib.c
@@ -12,7 +13,8 @@ lib_LTLIBRARIES = xineplug_decode_mpeg2.la
# decode.c idct_mmx.c motion_comp_mmx.c
xineplug_decode_mpeg2_la_SOURCES = slice.c header.c stats.c idct.c \
- motion_comp.c decode.c idct_mmx.c motion_comp_mmx.c xine_decoder.c
+ motion_comp.c decode.c idct_mmx.c motion_comp_mmx.c \
+ idct_mlib.c motion_comp_mlib.c xine_decoder.c
xineplug_decode_mpeg2_la_LDFLAGS = -avoid-version -module
noinst_HEADERS = vlc.h mpeg2.h mpeg2_internal.h
diff --git a/src/libw32dll/Makefile.am b/src/libw32dll/Makefile.am
index 338040d93..dc70ec334 100644
--- a/src/libw32dll/Makefile.am
+++ b/src/libw32dll/Makefile.am
@@ -19,7 +19,7 @@ lib_LTLIBRARIES = $(w32dll_codec)
xineplug_decode_w32dll_la_SOURCES = w32codec.c
xineplug_decode_w32dll_la_LDFLAGS = -avoid-version -module
-xineplug_decode_w32dll_la_LIBADD = $(top_builddir)/src/libw32dll/wine/libwine.la
+xineplug_decode_w32dll_la_LIBADD = $(top_builddir)/src/libw32dll/wine/libwine.la @KSTAT_LIBS@
noinst_HEADERS = w32codec.h
diff --git a/src/libw32dll/w32codec.c b/src/libw32dll/w32codec.c
index 924618f2f..a74b843fa 100644
--- a/src/libw32dll/w32codec.c
+++ b/src/libw32dll/w32codec.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: w32codec.c,v 1.7 2001/06/18 12:56:28 guenter Exp $
+ * $Id: w32codec.c,v 1.8 2001/06/21 17:34:23 guenter Exp $
*
* routines for using w32 codecs
*
@@ -239,8 +239,9 @@ static void w32v_init_codec (w32v_decoder_t *this) {
this->size = 0;
if (!( (this->video_out->get_capabilities (this->video_out)) & VO_CAP_YUY2)) {
- printf ("video output driver doesn't support YUY2 !!");
+ printf ("video output driver doesn't support YUY2 !!\n");
this->decoder_ok = 0;
+ return;
}
this->our_out_buffer = malloc (this->o_bih.biSizeImage);
diff --git a/src/libw32dll/wine/Makefile.am b/src/libw32dll/wine/Makefile.am
index 7fb454cdd..711758b16 100644
--- a/src/libw32dll/wine/Makefile.am
+++ b/src/libw32dll/wine/Makefile.am
@@ -7,10 +7,10 @@ noinst_LTLIBRARIES = $(wine_lib)
## all of them.
##
CFLAGS = @BUILD_LIB_STATIC@ -fno-omit-frame-pointer @X_CFLAGS@ \
- -DWIN32_PATH=\"@w32_path@\" -pipe
+ -DWIN32_PATH=\"@w32_path@\" -D_REENTRANT -pipe
DEBUG_CFLAGS = @BUILD_LIB_STATIC@ -fno-omit-frame-pointer @X_CFLAGS@ \
- -pipe -g -DSTATIC_WIN32_PATH
+ -DWIN32_PATH=\\\"@w32_path@\\\" -D_REENTRANT -pipe -g
if HAVE_W32DLL
@@ -24,7 +24,7 @@ libwine_la_LIBADD = stubs.lo
noinst_HEADERS = avifmt.h elfdll.h msacm.h pshpack1.h winbase.h \
winnt.h basetsd.h heap.h msacmdrv.h pshpack2.h\
- windef.h winreg.h config.h ldt.h ntdef.h \
+ windef.h winreg.h ldt.h ntdef.h \
pshpack4.h windows.h winuser.h debugtools.h mmreg.h \
pe_image.h pshpack8.h winerror.h driver.h module.h \
poppack.h vfw.h loader.h registry.h win32.h \
diff --git a/src/libw32dll/wine/config.h b/src/libw32dll/wine/config.h
deleted file mode 100644
index dc651b3d8..000000000
--- a/src/libw32dll/wine/config.h
+++ /dev/null
@@ -1,442 +0,0 @@
-/* include/config.h. Generated automatically by configure. */
-/* include/config.h.in. Generated automatically from configure.in by autoheader. */
-
-/* Define if using alloca.c. */
-/* #undef C_ALLOCA */
-
-/* Define to empty if the keyword does not work. */
-/* #undef const */
-
-/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
- This function is required for alloca.c support on those systems. */
-/* #undef CRAY_STACKSEG_END */
-
-/* Define if you have alloca, as a function or macro. */
-#define HAVE_ALLOCA 1
-
-/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
-#define HAVE_ALLOCA_H 1
-
-/* Define as __inline if that's what the C compiler calls it. */
-/* #undef inline */
-
-/* Define to `unsigned' if <sys/types.h> doesn't define. */
-/* #undef size_t */
-
-/* If using the C implementation of alloca, define if you know the
- direction of stack growth for your system; otherwise it will be
- automatically deduced at run-time.
- STACK_DIRECTION > 0 => grows toward higher addresses
- STACK_DIRECTION < 0 => grows toward lower addresses
- STACK_DIRECTION = 0 => direction of growth unknown
- */
-/* #undef STACK_DIRECTION */
-
-/* Define if the `S_IS*' macros in <sys/stat.h> do not work properly. */
-/* #undef STAT_MACROS_BROKEN */
-
-/* Define if you have the ANSI C header files. */
-#define STDC_HEADERS 1
-
-/* Define if your processor stores words with the most significant
- byte first (like Motorola and SPARC, unlike Intel and VAX). */
-/* #undef WORDS_BIGENDIAN */
-
-/* Define if the X Window System is missing or not being used. */
-/* #undef X_DISPLAY_MISSING */
-
-/* Define if symbols declared in assembly code need an underscore prefix */
-/* #undef NEED_UNDERSCORE_PREFIX */
-
-/* Define to use .string instead of .ascii */
-#define HAVE_ASM_STRING 1
-
-/* Define if struct msghdr contains msg_accrights */
-/* #undef HAVE_MSGHDR_ACCRIGHTS */
-
-/* Define if struct sockaddr_un contains sun_len */
-/* #undef HAVE_SOCKADDR_SUN_LEN */
-
-/* Define if you have the Xxf86dga library (-lXxf86dga). */
-#define HAVE_LIBXXF86DGA 1
-
-/* Define if you have the Xxf86dga library version 2.0 (-lXxf86dga). */
-/* #undef HAVE_LIBXXF86DGA2 */
-
-/* Define if you have the X Shm extension */
-#define HAVE_LIBXXSHM 1
-
-/* Define if you have the Xxf86vm library */
-#define HAVE_LIBXXF86VM 1
-
-/* Define if you have the Xpm library */
-#define HAVE_LIBXXPM 1
-
-/* Define if you have the Open Sound system. */
-#define HAVE_OSS 1
-
-/* Define if you have the Open Sound system (MIDI interface). */
-#define HAVE_OSS_MIDI 1
-
-/* Define if X libraries are not reentrant (compiled without -D_REENTRANT). */
-/* #undef NO_REENTRANT_X11 */
-
-/* Define if libc is not reentrant */
-/* #undef NO_REENTRANT_LIBC */
-
-/* Define if libc uses __errno_location for reentrant errno */
-#define HAVE__ERRNO_LOCATION 1
-
-/* Define if libc uses __error for reentrant errno */
-/* #undef HAVE__ERROR */
-
-/* Define if libc uses ___errno for reentrant errno */
-/* #undef HAVE___ERRNO */
-
-/* Define if libc uses __thr_errno for reentrant errno */
-/* #undef HAVE__THR_ERRNO */
-
-/* Define if all debug messages are to be compiled out */
-/* #undef NO_DEBUG_MSGS */
-
-/* Define if TRACE messages are to be compiled out */
-/* #undef NO_TRACE_MSGS */
-
-/* Define if the struct statfs has the member bavail */
-#define STATFS_HAS_BAVAIL 1
-
-/* Define if the struct statfs has the member bfree */
-#define STATFS_HAS_BFREE 1
-
-/* Define if the struct statfs is defined by <sys/vfs.h> */
-#define STATFS_DEFINED_BY_SYS_VFS 1
-
-/* Define if the struct statfs is defined by <sys/statfs.h> */
-#define STATFS_DEFINED_BY_SYS_STATFS 1
-
-/* Define if the struct statfs is defined by <sys/mount.h> */
-/* #undef STATFS_DEFINED_BY_SYS_MOUNT */
-
-/* Define if ncurses have the new resizeterm function */
-#define HAVE_RESIZETERM 1
-
-/* Define if ncurses have the new getbkgd function */
-#define HAVE_GETBKGD 1
-
-/* Define if IPX should use netipx/ipx.h from libc */
-#define HAVE_IPX_GNU 1
-
-/* Define if IPX includes are taken from Linux kernel */
-/* #undef HAVE_IPX_LINUX */
-
-/* Define if Mesa is present on the system or not */
-/* #undef HAVE_LIBMESAGL */
-
-/* Define if the system has dynamic link library support with the dl* API */
-#define HAVE_DL_API 1
-
-/* Define if <linux/joystick.h> defines the Linux 2.2 joystick API */
-#define HAVE_LINUX_22_JOYSTICK_API 1
-
-/* Define if the OpenGL implementation supports the GL_EXT_color_table extension */
-/* #undef HAVE_GL_COLOR_TABLE */
-
-/* Define if the OpenGL implementation supports the GL_EXT_paletted_texture extension */
-/* #undef HAVE_GL_PALETTED_TEXTURE */
-
-/* The number of bytes in a long long. */
-#define SIZEOF_LONG_LONG 8
-
-/* Define if you have the __libc_fork function. */
-/* #undef HAVE___LIBC_FORK */
-
-/* Define if you have the _lwp_create function. */
-/* #undef HAVE__LWP_CREATE */
-
-/* Define if you have the clone function. */
-#define HAVE_CLONE 1
-
-/* Define if you have the connect function. */
-#define HAVE_CONNECT 1
-
-/* Define if you have the dlopen function. */
-/* #undef HAVE_DLOPEN */
-
-/* Define if you have the gethostbyname function. */
-#define HAVE_GETHOSTBYNAME 1
-
-/* Define if you have the getnetbyaddr function. */
-#define HAVE_GETNETBYADDR 1
-
-/* Define if you have the getnetbyname function. */
-#define HAVE_GETNETBYNAME 1
-
-/* Define if you have the getpagesize function. */
-#define HAVE_GETPAGESIZE 1
-
-/* Define if you have the getprotobyname function. */
-#define HAVE_GETPROTOBYNAME 1
-
-/* Define if you have the getprotobynumber function. */
-#define HAVE_GETPROTOBYNUMBER 1
-
-/* Define if you have the getservbyport function. */
-#define HAVE_GETSERVBYPORT 1
-
-/* Define if you have the getsockopt function. */
-#define HAVE_GETSOCKOPT 1
-
-/* Define if you have the inet_network function. */
-#define HAVE_INET_NETWORK 1
-
-/* Define if you have the memmove function. */
-#define HAVE_MEMMOVE 1
-
-/* Define if you have the openpty function. */
-#define HAVE_OPENPTY 1
-
-/* Define if you have the rfork function. */
-/* #undef HAVE_RFORK */
-
-/* Define if you have the select function. */
-#define HAVE_SELECT 1
-
-/* Define if you have the sendmsg function. */
-#define HAVE_SENDMSG 1
-
-/* Define if you have the settimeofday function. */
-#define HAVE_SETTIMEOFDAY 1
-
-/* Define if you have the sigaltstack function. */
-#define HAVE_SIGALTSTACK 1
-
-/* Define if you have the statfs function. */
-#define HAVE_STATFS 1
-
-/* Define if you have the strcasecmp function. */
-#define HAVE_STRCASECMP 1
-
-/* Define if you have the strerror function. */
-#define HAVE_STRERROR 1
-
-/* Define if you have the strncasecmp function. */
-#define HAVE_STRNCASECMP 1
-
-/* Define if you have the tcgetattr function. */
-#define HAVE_TCGETATTR 1
-
-/* Define if you have the timegm function. */
-#define HAVE_TIMEGM 1
-
-/* Define if you have the usleep function. */
-#define HAVE_USLEEP 1
-
-/* Define if you have the vfscanf function. */
-#define HAVE_VFSCANF 1
-
-/* Define if you have the wait4 function. */
-#define HAVE_WAIT4 1
-
-/* Define if you have the waitpid function. */
-#define HAVE_WAITPID 1
-
-/* Define if you have the <GL/gl.h> header file. */
-/* #undef HAVE_GL_GL_H */
-
-/* Define if you have the <GL/glx.h> header file. */
-/* #undef HAVE_GL_GLX_H */
-
-/* Define if you have the <X11/Xlib.h> header file. */
-#define HAVE_X11_XLIB_H 1
-
-/* Define if you have the <X11/extensions/XShm.h> header file. */
-#define HAVE_X11_EXTENSIONS_XSHM_H 1
-
-/* Define if you have the <X11/extensions/xf86dga.h> header file. */
-#define HAVE_X11_EXTENSIONS_XF86DGA_H 1
-
-/* Define if you have the <X11/extensions/xf86vmode.h> header file. */
-#define HAVE_X11_EXTENSIONS_XF86VMODE_H 1
-
-/* Define if you have the <X11/xpm.h> header file. */
-#define HAVE_X11_XPM_H 1
-
-/* Define if you have the <a.out.h> header file. */
-#define HAVE_A_OUT_H 1
-
-/* Define if you have the <a_out.h> header file. */
-#define HAVE_A_OUT_H 1
-
-/* Define if you have the <arpa/inet.h> header file. */
-#define HAVE_ARPA_INET_H 1
-
-/* Define if you have the <arpa/nameser.h> header file. */
-#define HAVE_ARPA_NAMESER_H 1
-
-/* Define if you have the <curses.h> header file. */
-/* #undef HAVE_CURSES_H */
-
-/* Define if you have the <dlfcn.h> header file. */
-#define HAVE_DLFCN_H 1
-
-/* Define if you have the <elf.h> header file. */
-#define HAVE_ELF_H 1
-
-/* Define if you have the <float.h> header file. */
-#define HAVE_FLOAT_H 1
-
-/* Define if you have the <libio.h> header file. */
-#define HAVE_LIBIO_H 1
-
-/* Define if you have the <link.h> header file. */
-#define HAVE_LINK_H 1
-
-/* Define if you have the <linux/cdrom.h> header file. */
-#define HAVE_LINUX_CDROM_H 1
-
-/* Define if you have the <linux/joystick.h> header file. */
-#define HAVE_LINUX_JOYSTICK_H 1
-
-/* Define if you have the <linux/ucdrom.h> header file. */
-/* #undef HAVE_LINUX_UCDROM_H */
-
-/* Define if you have the <machine/soundcard.h> header file. */
-/* #undef HAVE_MACHINE_SOUNDCARD_H */
-
-/* Define if you have the <ncurses.h> header file. */
-#define HAVE_NCURSES_H 1
-
-/* Define if you have the <net/if.h> header file. */
-#define HAVE_NET_IF_H 1
-
-/* Define if you have the <netinet/in.h> header file. */
-#define HAVE_NETINET_IN_H 1
-
-/* Define if you have the <netinet/tcp.h> header file. */
-#define HAVE_NETINET_TCP_H 1
-
-/* Define if you have the <pty.h> header file. */
-#define HAVE_PTY_H 1
-
-/* Define if you have the <resolv.h> header file. */
-#define HAVE_RESOLV_H 1
-
-/* Define if you have the <sched.h> header file. */
-#define HAVE_SCHED_H 1
-
-/* Define if you have the <socket.h> header file. */
-/* #undef HAVE_SOCKET_H */
-
-/* Define if you have the <soundcard.h> header file. */
-/* #undef HAVE_SOUNDCARD_H */
-
-/* Define if you have the <strings.h> header file. */
-#define HAVE_STRINGS_H 1
-
-/* Define if you have the <sys/cdio.h> header file. */
-/* #undef HAVE_SYS_CDIO_H */
-
-/* Define if you have the <sys/errno.h> header file. */
-#define HAVE_SYS_ERRNO_H 1
-
-/* Define if you have the <sys/file.h> header file. */
-#define HAVE_SYS_FILE_H 1
-
-/* Define if you have the <sys/filio.h> header file. */
-/* #undef HAVE_SYS_FILIO_H */
-
-/* Define if you have the <sys/ipc.h> header file. */
-#define HAVE_SYS_IPC_H 1
-
-/* Define if you have the <sys/lwp.h> header file. */
-/* #undef HAVE_SYS_LWP_H */
-
-/* Define if you have the <sys/mman.h> header file. */
-#define HAVE_SYS_MMAN_H 1
-
-/* Define if you have the <sys/modem.h> header file. */
-/* #undef HAVE_SYS_MODEM_H */
-
-/* Define if you have the <sys/mount.h> header file. */
-#define HAVE_SYS_MOUNT_H 1
-
-/* Define if you have the <sys/msg.h> header file. */
-#define HAVE_SYS_MSG_H 1
-
-/* Define if you have the <sys/param.h> header file. */
-#define HAVE_SYS_PARAM_H 1
-
-/* Define if you have the <sys/reg.h> header file. */
-#define HAVE_SYS_REG_H 1
-
-/* Define if you have the <sys/shm.h> header file. */
-#define HAVE_SYS_SHM_H 1
-
-/* Define if you have the <sys/signal.h> header file. */
-#define HAVE_SYS_SIGNAL_H 1
-
-/* Define if you have the <sys/socket.h> header file. */
-#define HAVE_SYS_SOCKET_H 1
-
-/* Define if you have the <sys/sockio.h> header file. */
-/* #undef HAVE_SYS_SOCKIO_H */
-
-/* Define if you have the <sys/soundcard.h> header file. */
-#define HAVE_SYS_SOUNDCARD_H 1
-
-/* Define if you have the <sys/statfs.h> header file. */
-#define HAVE_SYS_STATFS_H 1
-
-/* Define if you have the <sys/strtio.h> header file. */
-/* #undef HAVE_SYS_STRTIO_H */
-
-/* Define if you have the <sys/syscall.h> header file. */
-#define HAVE_SYS_SYSCALL_H 1
-
-/* Define if you have the <sys/v86.h> header file. */
-/* #undef HAVE_SYS_V86_H */
-
-/* Define if you have the <sys/v86intr.h> header file. */
-/* #undef HAVE_SYS_V86INTR_H */
-
-/* Define if you have the <sys/vfs.h> header file. */
-#define HAVE_SYS_VFS_H 1
-
-/* Define if you have the <sys/vm86.h> header file. */
-#define HAVE_SYS_VM86_H 1
-
-/* Define if you have the <sys/wait.h> header file. */
-#define HAVE_SYS_WAIT_H 1
-
-/* Define if you have the <syscall.h> header file. */
-#define HAVE_SYSCALL_H 1
-
-/* Define if you have the <ucontext.h> header file. */
-#define HAVE_UCONTEXT_H 1
-
-/* Define if you have the <wctype.h> header file. */
-#define HAVE_WCTYPE_H 1
-
-/* Define if you have the curses library (-lcurses). */
-/* #undef HAVE_LIBCURSES */
-
-/* Define if you have the i386 library (-li386). */
-/* #undef HAVE_LIBI386 */
-
-/* Define if you have the m library (-lm). */
-#define HAVE_LIBM 1
-
-/* Define if you have the mmap library (-lmmap). */
-/* #undef HAVE_LIBMMAP */
-
-/* Define if you have the ncurses library (-lncurses). */
-#define HAVE_LIBNCURSES 1
-
-/* Define if you have the ossaudio library (-lossaudio). */
-/* #undef HAVE_LIBOSSAUDIO */
-
-/* Define if you have the w library (-lw). */
-/* #undef HAVE_LIBW */
-
-/* Define if you have the xpg4 library (-lxpg4). */
-/* #undef HAVE_LIBXPG4 */
diff --git a/src/libw32dll/wine/win32.c b/src/libw32dll/wine/win32.c
index 2ca3e3bbd..294616efc 100644
--- a/src/libw32dll/wine/win32.c
+++ b/src/libw32dll/wine/win32.c
@@ -12,16 +12,18 @@
#include "win32.h"
#include <stdio.h>
+#include <stdlib.h>
#include <pthread.h>
#ifdef HAVE_MALLOC_H
#include <malloc.h>
-#else
-#include <stdlib.h>
#endif
#include <time.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/timeb.h>
+#if HAVE_KSTAT
+#include <kstat.h>
+#endif
#include "winbase.h"
#include "winreg.h"
@@ -32,6 +34,23 @@
#include "registry.h"
#include "loader.h"
+
+static void
+do_cpuid(unsigned int ax, unsigned int *regs)
+{
+ __asm__ __volatile__ (
+ "pushl %%ebx; pushl %%ecx; pushl %%edx;"
+ ".byte 0x0f, 0xa2;"
+ "movl %%eax, (%2);"
+ "movl %%ebx, 4(%2);"
+ "movl %%ecx, 8(%2);"
+ "movl %%edx, 12(%2);"
+ "popl %%edx; popl %%ecx; popl %%ebx;"
+ : "=a" (ax)
+ : "0" (ax), "S" (regs)
+ );
+}
+
#ifdef USE_TSC
static unsigned int localcount()
{
@@ -446,14 +465,34 @@ void WINAPI expGetSystemInfo(SYSTEM_INFO* si)
cachedsi.wProcessorLevel = 3; /* pentium */
cachedsi.wProcessorRevision = 0;
-#ifdef __FreeBSD__
- cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM;
- cachedsi.wProcessorLevel= 5;
- PF[PF_COMPARE_EXCHANGE_DOUBLE] = TRUE;
-#ifdef MMX
- PF[PF_MMX_INSTRUCTIONS_AVAILABLE] = TRUE;
-#endif
- cachedsi.dwNumberOfProcessors=1;
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__svr4__)
+ {
+ unsigned int regs[4];
+ do_cpuid(1, regs);
+ switch ((regs[0] >> 8) & 0xf) { // cpu family
+ case 3: cachedsi.dwProcessorType = PROCESSOR_INTEL_386;
+ cachedsi.wProcessorLevel= 3;
+ break;
+ case 4: cachedsi.dwProcessorType = PROCESSOR_INTEL_486;
+ cachedsi.wProcessorLevel= 4;
+ break;
+ case 5: cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM;
+ cachedsi.wProcessorLevel= 5;
+ break;
+ case 6: cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM;
+ cachedsi.wProcessorLevel= 5;
+ break;
+ default:cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM;
+ cachedsi.wProcessorLevel= 5;
+ break;
+ }
+ cachedsi.wProcessorRevision = regs[0] & 0xf; // stepping
+ if (regs[3] & (1 << 8))
+ PF[PF_COMPARE_EXCHANGE_DOUBLE] = TRUE;
+ if (regs[3] & (1 << 23))
+ PF[PF_MMX_INSTRUCTIONS_AVAILABLE] = TRUE;
+ cachedsi.dwNumberOfProcessors=1;
+ }
#else
{
char buf[20];
@@ -570,7 +609,7 @@ void WINAPI expGetSystemInfo(SYSTEM_INFO* si)
}
fclose (f);
}
-#endif /* __FreeBSD__ */
+#endif /* __FreeBSD__ __NetBSD__ __svr4__*/
memcpy(si,&cachedsi,sizeof(*si));
}
@@ -911,10 +950,83 @@ long WINAPI expQueryPerformanceCounter(long long* z)
return 1;
}
-static double old_freq()
+static double
+linux_cpuinfo_freq()
+{
+ double freq=-1;
+ FILE *f;
+ char line[200];
+ char *s,*value;
+
+ f = fopen ("/proc/cpuinfo", "r");
+ if (f != NULL) {
+ while (fgets(line,200,f) != NULL) {
+ /* NOTE: the ':' is the only character we can rely on */
+ if (!(value = strchr(line,':')))
+ continue;
+ /* terminate the valuename */
+ *value++ = '\0';
+ /* skip any leading spaces */
+ while (*value==' ') value++;
+ if ((s=strchr(value,'\n')))
+ *s='\0';
+
+ if (!strncasecmp(line, "cpu MHz",strlen("cpu MHz"))
+ && sscanf(value, "%lf", &freq) == 1) {
+ freq*=1000;
+ break;
+ }
+ }
+ fclose(f);
+ }
+ return freq;
+}
+
+static double
+solaris_kstat_freq()
+{
+#if HAVE_KSTAT
+ /*
+ * try to extact the CPU speed from the solaris kernel's kstat data
+ */
+ kstat_ctl_t *kc;
+ kstat_t *ksp;
+ kstat_named_t *kdata;
+ int mhz = 0;
+
+ kc = kstat_open();
+ if (kc != NULL)
+ {
+ ksp = kstat_lookup(kc, "cpu_info", 0, "cpu_info0");
+
+ /* kstat found and name/value pairs? */
+ if (ksp != NULL && ksp->ks_type == KSTAT_TYPE_NAMED)
+ {
+ /* read the kstat data from the kernel */
+ if (kstat_read(kc, ksp, NULL) != -1)
+ {
+ /*
+ * lookup desired "clock_MHz" entry, check the expected
+ * data type
+ */
+ kdata = (kstat_named_t *)kstat_data_lookup(ksp, "clock_MHz");
+ if (kdata != NULL && kdata->data_type == KSTAT_DATA_INT32)
+ mhz = kdata->value.i32;
+ }
+ }
+ kstat_close(kc);
+ }
+
+ if (mhz > 0)
+ return mhz * 1000.;
+#endif /* HAVE_KSTAT */
+ return -1;
+}
+
+static double tsc_freq()
{
int i=time(NULL);
- int x,y;
+ unsigned int x,y;
while(i==time(NULL));
x=localcount();
i++;
@@ -922,48 +1034,18 @@ static double old_freq()
y=localcount();
return (double)(y-x)/1000.;
}
+
static double CPU_Freq()
{
-#ifdef USE_TSC
- FILE *f = fopen ("/proc/cpuinfo", "r");
- char line[200];
- char model[200]="unknown";
- char flags[500]="";
- char *s,*value;
- double freq=-1;
+ double freq;
- if (!f)
- {
- printf("Can't open /proc/cpuinfo for reading\n");
- return old_freq();
- }
- while (fgets(line,200,f)!=NULL)
- {
- /* NOTE: the ':' is the only character we can rely on */
- if (!(value = strchr(line,':')))
- continue;
- /* terminate the valuename */
- *value++ = '\0';
- /* skip any leading spaces */
- while (*value==' ') value++;
- if ((s=strchr(value,'\n')))
- *s='\0';
+ if ((freq = linux_cpuinfo_freq()) > 0)
+ return freq;
- if (!strncasecmp(line, "cpu MHz",strlen("cpu MHz")))
- {
- sscanf(value, "%lf", &freq);
- freq*=1000;
- break;
- }
- continue;
-
- }
- fclose(f);
- if(freq<0)return old_freq();
+ if ((freq = solaris_kstat_freq()) > 0)
return freq;
-#else
- return old_freq();
-#endif
+
+ return tsc_freq();
}
long WINAPI expQueryPerformanceFrequency(long long* z)
diff --git a/src/video_out/video_out_syncfb.c b/src/video_out/video_out_syncfb.c
index fa09ddf99..ae3435d72 100644
--- a/src/video_out/video_out_syncfb.c
+++ b/src/video_out/video_out_syncfb.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: video_out_syncfb.c,v 1.5 2001/06/14 18:32:57 guenter Exp $
+ * $Id: video_out_syncfb.c,v 1.6 2001/06/21 17:34:24 guenter Exp $
*
* video_out_syncfb.c, Matrox G400 video extension interface for xine
*
@@ -54,6 +54,10 @@
#include <linux/config.h> /* Check for DEVFS */
#endif
+#if defined(__sun)
+#include <sys/ioccom.h>
+#endif
+
#include "video_out.h"
#include "video_out_x11.h"
#include "video_out_syncfb.h"
diff --git a/src/video_out/video_out_xshm.c b/src/video_out/video_out_xshm.c
index 3284f92e2..3fac1dad7 100644
--- a/src/video_out/video_out_xshm.c
+++ b/src/video_out/video_out_xshm.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: video_out_xshm.c,v 1.9 2001/06/14 20:17:06 guenter Exp $
+ * $Id: video_out_xshm.c,v 1.10 2001/06/21 17:34:24 guenter Exp $
*
* video_out_xshm.c, X11 shared memory extension interface for xine
*
@@ -69,6 +69,7 @@ typedef struct xshm_frame_s {
XImage *image;
uint8_t *rgb_dst;
+ int rgb_row;
int stripe_inc;
XShmSegmentInfo shminfo;
@@ -211,6 +212,8 @@ static XImage *create_ximage (xshm_driver_t *this, XShmSegmentInfo *shminfo,
if (shminfo->shmaddr == ((char *) -1)) {
printf ("video_out_xshm: shared memory error (address error) when allocating image \n");
printf ("video_out_xshm: => not using MIT Shared Memory extension.\n");
+ shmctl (shminfo->shmid, IPC_RMID, 0);
+ shminfo->shmid = -1;
this->use_shm = 0;
goto finishShmTesting;
}
@@ -225,8 +228,22 @@ static XImage *create_ximage (xshm_driver_t *this, XShmSegmentInfo *shminfo,
if (gX11Fail) {
printf ("video_out_xshm: x11 error during shared memory XImage creation\n");
printf ("video_out_xshm: => not using MIT Shared Memory extension.\n");
+ shmdt (shminfo->shmaddr);
+ shmctl (shminfo->shmid, IPC_RMID, 0);
+ shminfo->shmid = -1;
this->use_shm = 0;
+ goto finishShmTesting;
}
+
+ /*
+ * Now that the Xserver has learned about and attached to the
+ * shared memory segment, delete it. It's actually deleted by
+ * the kernel when all users of that segment have detached from
+ * it. Gives an automatic shared memory cleanup in case we crash.
+ */
+ shmctl (shminfo->shmid, IPC_RMID, 0);
+ shminfo->shmid = -1;
+
finishShmTesting:
x11_DeInstallXErrorHandler(this);
@@ -283,7 +300,10 @@ static void dispose_ximage (xshm_driver_t *this,
XShmDetach (this->display, shminfo);
XDestroyImage (myimage);
shmdt (shminfo->shmaddr);
- shmctl (shminfo->shmid, IPC_RMID, 0);
+ if (shminfo->shmid >= 0) {
+ shmctl (shminfo->shmid, IPC_RMID, 0);
+ shminfo->shmid = -1;
+ }
} else {
@@ -304,10 +324,25 @@ static void xshm_frame_copy (vo_frame_t *vo_img, uint8_t **src) {
xshm_frame_t *frame = (xshm_frame_t *) vo_img ;
xshm_driver_t *this = (xshm_driver_t *) vo_img->instance->driver;
+#if 0
+#warning FIXME
+ /*
+ * A complete stripe may not fit into the destination rgb image.
+ * Ignore the stripe for now, instead of crashing inside yuv2rgb_fun().
+ */
+ if (frame->rgb_row + this->stripe_height > frame->rgb_height) {
+ printf("xshm_frame_copy: stripe %d..%d out of rgb image bounds %d\n",
+ frame->rgb_row, frame->rgb_row+this->stripe_height-1,
+ frame->rgb_height);
+ return;
+ }
+#endif
+
this->yuv2rgb->yuv2rgb_fun (this->yuv2rgb, frame->rgb_dst,
src[0], src[1], src[2]);
frame->rgb_dst += frame->stripe_inc;
+ frame->rgb_row += this->stripe_height;
}
static void xshm_frame_field (vo_frame_t *vo_img, int which_field) {
@@ -364,6 +399,9 @@ static void xshm_calc_output_size (xshm_driver_t *this) {
* aspect ratio calculation
*/
+ if (this->delivered_width == 0 && this->delivered_height == 0)
+ return; /* ConfigureNotify/VisibilityNotify, no decoder output size known */
+
image_ratio =
(double) this->delivered_width / (double) this->delivered_height;
@@ -525,6 +563,7 @@ static void xshm_update_frame_format (vo_driver_t *this_gen,
if (frame->image) {
frame->rgb_dst = frame->image->data;
+ frame->rgb_row = 0;
frame->stripe_inc = this->stripe_height * frame->image->bytes_per_line;
}
}
@@ -806,7 +845,7 @@ vo_driver_t *init_video_out_plugin (config_values_t *config, void *visual_gen) {
mode = 0;
- printf ("video_out_xshm: video mode is %d depth (%d bpp), red: %08x, green: %08x, blue: %08x\n",
+ printf ("video_out_xshm: video mode is %d depth (%d bpp), red: %08lx, green: %08lx, blue: %08lx\n",
this->depth, this->bpp, this->vinfo.red_mask, this->vinfo.green_mask,
this->vinfo.blue_mask);
diff --git a/src/video_out/yuv2rgb.c b/src/video_out/yuv2rgb.c
index e4b60033f..7abfdac0e 100644
--- a/src/video_out/yuv2rgb.c
+++ b/src/video_out/yuv2rgb.c
@@ -42,23 +42,6 @@ const int32_t Inverse_Table_6_9[8][4] = {
{117579, 136230, 16907, 35559} /* SMPTE 240M (1987) */
};
-static void yuv2rgb_c (yuv2rgb_t *this, uint8_t *image,
- uint8_t *py, uint8_t *pu, uint8_t *pv) {
-
- /* int dy = this->step_dy; */
- int height = this->source_height >>= 1;
-
- do {
- this->yuv2rgb_c_internal (this, py, py + this->y_stride, pu, pv,
- image, ((uint8_t *)image) + this->rgb_stride,
- this->source_width);
-
- py += 2 * this->y_stride;
- pu += this->uv_stride;
- pv += this->uv_stride;
- image = ((uint8_t *) image) + 2 * this->rgb_stride;
- } while (--height);
-}
static void *my_malloc_aligned (size_t alignment, size_t size, void **chunk) {
@@ -91,6 +74,19 @@ int yuv2rgb_setup (yuv2rgb_t *this,
this->dest_height = dest_height;
this->rgb_stride = rgb_stride;
+ if (this->y_chunk) {
+ free (this->y_chunk);
+ this->y_buffer = this->y_chunk = NULL;
+ }
+ if (this->u_chunk) {
+ free (this->u_chunk);
+ this->u_buffer = this->u_chunk = NULL;
+ }
+ if (this->v_chunk) {
+ free (this->v_chunk);
+ this->v_buffer = this->v_chunk = NULL;
+ }
+
if ((source_width == dest_width) && (source_height == dest_height))
this->do_scale = 0;
else {
@@ -99,10 +95,6 @@ int yuv2rgb_setup (yuv2rgb_t *this,
this->step_dx = source_width * 32768 / dest_width;
this->step_dy = source_height * 32768 / dest_height;
- if (this->y_chunk) free (this->y_chunk);
- if (this->u_chunk) free (this->u_chunk);
- if (this->v_chunk) free (this->v_chunk);
-
this->y_buffer = my_malloc_aligned (16, dest_width, &this->y_chunk);
if (!this->y_buffer)
return 0;
@@ -117,6 +109,34 @@ int yuv2rgb_setup (yuv2rgb_t *this,
}
+static void scale_line (uint8_t *source, uint8_t *dest,
+ int width, int step) {
+ int p1;
+ int p2;
+ int dx;
+
+ p1 = *source++;
+ p2 = *source++;
+ dx = 0;
+
+ while (width) {
+
+ *dest = (p1 * (32768 - dx) + p2 * dx) / 32768;
+
+ dx += step;
+ while (dx > 32768) {
+ dx -= 32768;
+ p1 = p2;
+ p2 = *source++;
+ }
+
+ dest ++;
+ width --;
+ }
+
+}
+
+
#define RGB(i) \
U = pu[i]; \
V = pv[i]; \
@@ -160,164 +180,505 @@ int yuv2rgb_setup (yuv2rgb_t *this,
Y = py_2[2*i+1]; \
dst_2[6*i+3] = b[Y]; dst_2[6*i+4] = g[Y]; dst_2[6*i+5] = r[Y];
-static void yuv2rgb_c_32 (yuv2rgb_t *this,
- uint8_t * py_1, uint8_t * py_2,
- uint8_t * pu, uint8_t * pv,
- void * _dst_1, void * _dst_2, int width)
+static void yuv2rgb_c_32 (yuv2rgb_t *this, uint8_t * _dst,
+ uint8_t * _py, uint8_t * _pu, uint8_t * _pv)
{
int U, V, Y;
+ uint8_t * py_1, * py_2, * pu, * pv;
uint32_t * r, * g, * b;
uint32_t * dst_1, * dst_2;
-
- width >>= 3;
- dst_1 = _dst_1;
- dst_2 = _dst_2;
-
- do {
- RGB(0);
- DST1(0);
- DST2(0);
-
- RGB(1);
- DST2(1);
- DST1(1);
-
- RGB(2);
- DST1(2);
- DST2(2);
-
- RGB(3);
- DST2(3);
- DST1(3);
-
- pu += 4;
- pv += 4;
- py_1 += 8;
- py_2 += 8;
- dst_1 += 8;
- dst_2 += 8;
- } while (--width);
+ int width, height;
+ int dy;
+
+ if (this->do_scale) {
+ scale_line (_pu, this->u_buffer,
+ this->dest_width >> 1, this->step_dx);
+ scale_line (_pv, this->v_buffer,
+ this->dest_width >> 1, this->step_dx);
+ scale_line (_py, this->y_buffer,
+ this->dest_width, this->step_dx);
+
+ dy = 0;
+ height = this->source_height;
+
+ for (;;) {
+ dst_1 = (uint32_t*)_dst;
+ py_1 = this->y_buffer;
+ pu = this->u_buffer;
+ pv = this->v_buffer;
+
+ width = this->dest_width >> 3;
+
+ do {
+ RGB(0);
+ DST1(0);
+
+ RGB(1);
+ DST1(1);
+
+ RGB(2);
+ DST1(2);
+
+ RGB(3);
+ DST1(3);
+
+ pu += 4;
+ pv += 4;
+ py_1 += 8;
+ dst_1 += 8;
+ } while (--width);
+
+ dy += this->step_dy;
+ _dst += this->rgb_stride;
+
+ while (dy <= 32768) {
+
+ memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width*4);
+
+ dy += this->step_dy;
+ _dst += this->rgb_stride;
+ }
+
+ if (--height <= 0)
+ break;
+
+ dy -= 32768;
+ _py += this->y_stride;
+
+ scale_line (_py, this->y_buffer,
+ this->dest_width, this->step_dx);
+
+ if (!(height & 1)) {
+ _pu += this->uv_stride;
+ _pv += this->uv_stride;
+
+ scale_line (_pu, this->u_buffer,
+ this->dest_width >> 1, this->step_dx);
+ scale_line (_pv, this->v_buffer,
+ this->dest_width >> 1, this->step_dx);
+
+ }
+ }
+ } else {
+ height = this->source_height >> 1;
+ do {
+ dst_1 = (uint32_t*)_dst;
+ dst_2 = (void*)( (uint8_t *)_dst + this->rgb_stride );
+ py_1 = _py;
+ py_2 = _py + this->y_stride;
+ pu = _pu;
+ pv = _pv;
+
+ width = this->source_width >> 3;
+ do {
+ RGB(0);
+ DST1(0);
+ DST2(0);
+
+ RGB(1);
+ DST2(1);
+ DST1(1);
+
+ RGB(2);
+ DST1(2);
+ DST2(2);
+
+ RGB(3);
+ DST2(3);
+ DST1(3);
+
+ pu += 4;
+ pv += 4;
+ py_1 += 8;
+ py_2 += 8;
+ dst_1 += 8;
+ dst_2 += 8;
+ } while (--width);
+
+ _dst += 2 * this->rgb_stride;
+ _py += 2 * this->y_stride;
+ _pu += this->uv_stride;
+ _pv += this->uv_stride;
+
+ } while (--height);
+ }
}
/* This is very near from the yuv2rgb_c_32 code */
-static void yuv2rgb_c_24_rgb (yuv2rgb_t *this,
- uint8_t * py_1, uint8_t * py_2,
- uint8_t * pu, uint8_t * pv,
- void * _dst_1, void * _dst_2, int width)
+static void yuv2rgb_c_24_rgb (yuv2rgb_t *this, uint8_t * _dst,
+ uint8_t * _py, uint8_t * _pu, uint8_t * _pv)
{
int U, V, Y;
+ uint8_t * py_1, * py_2, * pu, * pv;
uint8_t * r, * g, * b;
uint8_t * dst_1, * dst_2;
-
- width >>= 3;
- dst_1 = _dst_1;
- dst_2 = _dst_2;
-
- do {
- RGB(0);
- DST1RGB(0);
- DST2RGB(0);
-
- RGB(1);
- DST2RGB(1);
- DST1RGB(1);
-
- RGB(2);
- DST1RGB(2);
- DST2RGB(2);
-
- RGB(3);
- DST2RGB(3);
- DST1RGB(3);
-
- pu += 4;
- pv += 4;
- py_1 += 8;
- py_2 += 8;
- dst_1 += 24;
- dst_2 += 24;
- } while (--width);
+ int width, height;
+ int dy;
+
+ if (this->do_scale) {
+
+ scale_line (_pu, this->u_buffer,
+ this->dest_width >> 1, this->step_dx);
+ scale_line (_pv, this->v_buffer,
+ this->dest_width >> 1, this->step_dx);
+ scale_line (_py, this->y_buffer,
+ this->dest_width, this->step_dx);
+
+ dy = 0;
+ height = this->source_height;
+
+ for (;;) {
+ dst_1 = _dst;
+ py_1 = this->y_buffer;
+ pu = this->u_buffer;
+ pv = this->v_buffer;
+
+ width = this->dest_width >> 3;
+
+ do {
+ RGB(0);
+ DST1RGB(0);
+
+ RGB(1);
+ DST1RGB(1);
+
+ RGB(2);
+ DST1RGB(2);
+
+ RGB(3);
+ DST1RGB(3);
+
+ pu += 4;
+ pv += 4;
+ py_1 += 8;
+ dst_1 += 24;
+ } while (--width);
+
+ dy += this->step_dy;
+ _dst += this->rgb_stride;
+
+ while (dy <= 32768) {
+
+ memcpy (_dst, _dst-this->rgb_stride, this->dest_width*3);
+
+ dy += this->step_dy;
+ _dst += this->rgb_stride;
+ }
+
+ if (--height <= 0)
+ break;
+
+ dy -= 32768;
+ _py += this->y_stride;
+
+ scale_line (_py, this->y_buffer,
+ this->dest_width, this->step_dx);
+
+ if (!(height & 1)) {
+ _pu += this->uv_stride;
+ _pv += this->uv_stride;
+
+ scale_line (_pu, this->u_buffer,
+ this->dest_width >> 1, this->step_dx);
+ scale_line (_pv, this->v_buffer,
+ this->dest_width >> 1, this->step_dx);
+
+ }
+ }
+ } else {
+ height = this->source_height >> 1;
+ do {
+ dst_1 = _dst;
+ dst_2 = (void*)( (uint8_t *)_dst + this->rgb_stride );
+ py_1 = _py;
+ py_2 = _py + this->y_stride;
+ pu = _pu;
+ pv = _pv;
+
+ width = this->source_width >> 3;
+ do {
+ RGB(0);
+ DST1RGB(0);
+ DST2RGB(0);
+
+ RGB(1);
+ DST2RGB(1);
+ DST1RGB(1);
+
+ RGB(2);
+ DST1RGB(2);
+ DST2RGB(2);
+
+ RGB(3);
+ DST2RGB(3);
+ DST1RGB(3);
+
+ pu += 4;
+ pv += 4;
+ py_1 += 8;
+ py_2 += 8;
+ dst_1 += 24;
+ dst_2 += 24;
+ } while (--width);
+
+ _dst += 2 * this->rgb_stride;
+ _py += 2 * this->y_stride;
+ _pu += this->uv_stride;
+ _pv += this->uv_stride;
+
+ } while (--height);
+ }
}
/* only trivial mods from yuv2rgb_c_24_rgb */
-static void yuv2rgb_c_24_bgr (yuv2rgb_t *this,
- uint8_t * py_1, uint8_t * py_2,
- uint8_t * pu, uint8_t * pv,
- void * _dst_1, void * _dst_2, int width)
+static void yuv2rgb_c_24_bgr (yuv2rgb_t *this, uint8_t * _dst,
+ uint8_t * _py, uint8_t * _pu, uint8_t * _pv)
{
int U, V, Y;
+ uint8_t * py_1, * py_2, * pu, * pv;
uint8_t * r, * g, * b;
uint8_t * dst_1, * dst_2;
+ int width, height;
+ int dy;
+
+ if (this->do_scale) {
+
+ scale_line (_pu, this->u_buffer,
+ this->dest_width >> 1, this->step_dx);
+ scale_line (_pv, this->v_buffer,
+ this->dest_width >> 1, this->step_dx);
+ scale_line (_py, this->y_buffer,
+ this->dest_width, this->step_dx);
+
+ dy = 0;
+ height = this->source_height;
+
+ for (;;) {
+ dst_1 = _dst;
+ py_1 = this->y_buffer;
+ pu = this->u_buffer;
+ pv = this->v_buffer;
+
+ width = this->dest_width >> 3;
+
+ do {
+ RGB(0);
+ DST1BGR(0);
+
+ RGB(1);
+ DST1BGR(1);
+
+ RGB(2);
+ DST1BGR(2);
+
+ RGB(3);
+ DST1BGR(3);
+
+ pu += 4;
+ pv += 4;
+ py_1 += 8;
+ dst_1 += 24;
+ } while (--width);
+
+ dy += this->step_dy;
+ _dst += this->rgb_stride;
+
+ while (dy <= 32768) {
+
+ memcpy (_dst, _dst-this->rgb_stride, this->dest_width*3);
+
+ dy += this->step_dy;
+ _dst += this->rgb_stride;
+ }
+
+ if (--height <= 0)
+ break;
+
+ dy -= 32768;
+ _py += this->y_stride;
+
+ scale_line (_py, this->y_buffer,
+ this->dest_width, this->step_dx);
+
+ if (!(height & 1)) {
+ _pu += this->uv_stride;
+ _pv += this->uv_stride;
+
+ scale_line (_pu, this->u_buffer,
+ this->dest_width >> 1, this->step_dx);
+ scale_line (_pv, this->v_buffer,
+ this->dest_width >> 1, this->step_dx);
+
+ }
+ }
- width >>= 3;
- dst_1 = _dst_1;
- dst_2 = _dst_2;
-
- do {
- RGB(0);
- DST1BGR(0);
- DST2BGR(0);
-
- RGB(1);
- DST2BGR(1);
- DST1BGR(1);
-
- RGB(2);
- DST1BGR(2);
- DST2BGR(2);
-
- RGB(3);
- DST2BGR(3);
- DST1BGR(3);
-
- pu += 4;
- pv += 4;
- py_1 += 8;
- py_2 += 8;
- dst_1 += 24;
- dst_2 += 24;
- } while (--width);
+ } else {
+ height = this->source_height >> 1;
+ do {
+ dst_1 = _dst;
+ dst_2 = (void*)( (uint8_t *)_dst + this->rgb_stride );
+ py_1 = _py;
+ py_2 = _py + this->y_stride;
+ pu = _pu;
+ pv = _pv;
+ width = this->source_width >> 3;
+ do {
+ RGB(0);
+ DST1BGR(0);
+ DST2BGR(0);
+
+ RGB(1);
+ DST2BGR(1);
+ DST1BGR(1);
+
+ RGB(2);
+ DST1BGR(2);
+ DST2BGR(2);
+
+ RGB(3);
+ DST2BGR(3);
+ DST1BGR(3);
+
+ pu += 4;
+ pv += 4;
+ py_1 += 8;
+ py_2 += 8;
+ dst_1 += 24;
+ dst_2 += 24;
+ } while (--width);
+
+ _dst += 2 * this->rgb_stride;
+ _py += 2 * this->y_stride;
+ _pu += this->uv_stride;
+ _pv += this->uv_stride;
+
+ } while (--height);
+ }
}
/* This is exactly the same code as yuv2rgb_c_32 except for the types of */
/* r, g, b, dst_1, dst_2 */
-static void yuv2rgb_c_16 (yuv2rgb_t *this,
- uint8_t * py_1, uint8_t * py_2,
- uint8_t * pu, uint8_t * pv,
- void * _dst_1, void * _dst_2, int width)
+static void yuv2rgb_c_16 (yuv2rgb_t *this, uint8_t * _dst,
+ uint8_t * _py, uint8_t * _pu, uint8_t * _pv)
{
int U, V, Y;
+ uint8_t * py_1, * py_2, * pu, * pv;
uint16_t * r, * g, * b;
uint16_t * dst_1, * dst_2;
-
- width >>= 3;
- dst_1 = _dst_1;
- dst_2 = _dst_2;
-
- do {
- RGB(0);
- DST1(0);
- DST2(0);
-
- RGB(1);
- DST2(1);
- DST1(1);
-
- RGB(2);
- DST1(2);
- DST2(2);
-
- RGB(3);
- DST2(3);
- DST1(3);
-
- pu += 4;
- pv += 4;
- py_1 += 8;
- py_2 += 8;
- dst_1 += 8;
- dst_2 += 8;
- } while (--width);
+ int width, height;
+ int dy;
+
+ if (this->do_scale) {
+ scale_line (_pu, this->u_buffer,
+ this->dest_width >> 1, this->step_dx);
+ scale_line (_pv, this->v_buffer,
+ this->dest_width >> 1, this->step_dx);
+ scale_line (_py, this->y_buffer,
+ this->dest_width, this->step_dx);
+
+ dy = 0;
+ height = this->source_height;
+
+ for (;;) {
+ dst_1 = (uint16_t*)_dst;
+ py_1 = this->y_buffer;
+ pu = this->u_buffer;
+ pv = this->v_buffer;
+
+ width = this->dest_width >> 3;
+
+ do {
+ RGB(0);
+ DST1(0);
+
+ RGB(1);
+ DST1(1);
+
+ RGB(2);
+ DST1(2);
+
+ RGB(3);
+ DST1(3);
+
+ pu += 4;
+ pv += 4;
+ py_1 += 8;
+ dst_1 += 8;
+ } while (--width);
+
+ dy += this->step_dy;
+ _dst += this->rgb_stride;
+
+ while (dy <= 32768) {
+
+ memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width*2);
+
+ dy += this->step_dy;
+ _dst += this->rgb_stride;
+ }
+
+ if (--height <= 0)
+ break;
+
+ dy -= 32768;
+ _py += this->y_stride;
+
+ scale_line (_py, this->y_buffer,
+ this->dest_width, this->step_dx);
+
+ if (!(height & 1)) {
+ _pu += this->uv_stride;
+ _pv += this->uv_stride;
+
+ scale_line (_pu, this->u_buffer,
+ this->dest_width >> 1, this->step_dx);
+ scale_line (_pv, this->v_buffer,
+ this->dest_width >> 1, this->step_dx);
+
+ }
+ }
+ } else {
+ height = this->source_height >> 1;
+ do {
+ dst_1 = (uint16_t*)_dst;
+ dst_2 = (void*)( (uint8_t *)_dst + this->rgb_stride );
+ py_1 = _py;
+ py_2 = _py + this->y_stride;
+ pu = _pu;
+ pv = _pv;
+ width = this->source_width >> 3;
+ do {
+ RGB(0);
+ DST1(0);
+ DST2(0);
+
+ RGB(1);
+ DST2(1);
+ DST1(1);
+
+ RGB(2);
+ DST1(2);
+ DST2(2);
+
+ RGB(3);
+ DST2(3);
+ DST1(3);
+
+ pu += 4;
+ pv += 4;
+ py_1 += 8;
+ py_2 += 8;
+ dst_1 += 8;
+ dst_2 += 8;
+ } while (--width);
+
+ _dst += 2 * this->rgb_stride;
+ _py += 2 * this->y_stride;
+ _pu += this->uv_stride;
+ _pv += this->uv_stride;
+
+ } while (--height);
+ }
}
static int div_round (int dividend, int divisor)
@@ -343,8 +704,6 @@ static void yuv2rgb_c_init (yuv2rgb_t *this, int mode)
int cgu = -Inverse_Table_6_9[this->matrix_coefficients][2];
int cgv = -Inverse_Table_6_9[this->matrix_coefficients][3];
- this->yuv2rgb_fun = yuv2rgb_c;
-
for (i = 0; i < 1024; i++) {
int j;
@@ -356,7 +715,7 @@ static void yuv2rgb_c_init (yuv2rgb_t *this, int mode)
switch (mode) {
case MODE_32_RGB:
case MODE_32_BGR:
- this->yuv2rgb_c_internal = yuv2rgb_c_32;
+ this->yuv2rgb_fun = yuv2rgb_c_32;
table_32 = malloc ((197 + 2*682 + 256 + 132) * sizeof (uint32_t));
@@ -377,7 +736,7 @@ static void yuv2rgb_c_init (yuv2rgb_t *this, int mode)
case MODE_24_RGB:
case MODE_24_BGR:
- this->yuv2rgb_c_internal = (mode==MODE_24_RGB) ? yuv2rgb_c_24_rgb : yuv2rgb_c_24_bgr;
+ this->yuv2rgb_fun = (mode==MODE_24_RGB) ? yuv2rgb_c_24_rgb : yuv2rgb_c_24_bgr;
table_8 = malloc ((256 + 2*232) * sizeof (uint8_t));
@@ -392,7 +751,7 @@ static void yuv2rgb_c_init (yuv2rgb_t *this, int mode)
case MODE_16_BGR:
case MODE_15_RGB:
case MODE_16_RGB:
- this->yuv2rgb_c_internal = yuv2rgb_c_16;
+ this->yuv2rgb_fun = yuv2rgb_c_16;
table_16 = malloc ((197 + 2*682 + 256 + 132) * sizeof (uint16_t));
@@ -452,9 +811,9 @@ yuv2rgb_t *yuv2rgb_init (int mode) {
this->matrix_coefficients = 6;
- this->y_buffer = NULL;
- this->u_buffer = NULL;
- this->v_buffer = NULL;
+ this->y_chunk = this->y_buffer = NULL;
+ this->y_chunk = this->u_buffer = NULL;
+ this->y_chunk = this->v_buffer = NULL;
/*
* auto-probe for the best yuv2rgb function
diff --git a/src/video_out/yuv2rgb.h b/src/video_out/yuv2rgb.h
index b966eca82..9a2e2fb0a 100644
--- a/src/video_out/yuv2rgb.h
+++ b/src/video_out/yuv2rgb.h
@@ -36,19 +36,17 @@ struct yuv2rgb_s {
int rgb_stride;
int step_dx, step_dy;
int do_scale;
- uint8_t *y_buffer, *y_chunk;
- uint8_t *u_buffer, *u_chunk;
- uint8_t *v_buffer, *v_chunk;
+ uint8_t *y_buffer;
+ uint8_t *u_buffer;
+ uint8_t *v_buffer;
+ void *y_chunk;
+ void *u_chunk;
+ void *v_chunk;
void *table_rV[256];
void *table_gU[256];
int table_gV[256];
void *table_bU[256];
-
- void (* yuv2rgb_c_internal) (yuv2rgb_t *this,
- uint8_t *, uint8_t *,
- uint8_t *, uint8_t *,
- void *, void *, int);
} ;
diff --git a/src/video_out/yuv2rgb_mmx.c b/src/video_out/yuv2rgb_mmx.c
index e7c828ff7..5277dd472 100644
--- a/src/video_out/yuv2rgb_mmx.c
+++ b/src/video_out/yuv2rgb_mmx.c
@@ -403,7 +403,7 @@ static inline void yuv420_rgb16 (yuv2rgb_t *this,
this->dest_width >> 1, this->step_dx);
scale_line (py, this->y_buffer,
this->dest_width, this->step_dx);
- do {
+ for (;;) {
y_buf = this->y_buffer;
u_buf = this->u_buffer;
@@ -432,6 +432,9 @@ static inline void yuv420_rgb16 (yuv2rgb_t *this,
image += rgb_stride;
}
+ if (--height <= 0)
+ break;
+
dy -= 32768;
py += y_stride;
@@ -439,7 +442,7 @@ static inline void yuv420_rgb16 (yuv2rgb_t *this,
scale_line (py, this->y_buffer,
this->dest_width, this->step_dx);
- if (height & 1) {
+ if (!(height & 1)) {
pu += uv_stride;
pv += uv_stride;
@@ -449,8 +452,7 @@ static inline void yuv420_rgb16 (yuv2rgb_t *this,
this->dest_width >> 1, this->step_dx);
}
- height--;
- } while (height>0);
+ }
}
}
@@ -507,7 +509,7 @@ static inline void yuv420_rgb15 (yuv2rgb_t *this,
this->dest_width >> 1, this->step_dx);
scale_line (py, this->y_buffer,
this->dest_width, this->step_dx);
- do {
+ for (;;) {
y_buf = this->y_buffer;
u_buf = this->u_buffer;
@@ -536,14 +538,16 @@ static inline void yuv420_rgb15 (yuv2rgb_t *this,
image += rgb_stride;
}
- dy -= 32768;
+ if (--height <= 0)
+ break;
+ dy -= 32768;
py += y_stride;
scale_line (py, this->y_buffer,
this->dest_width, this->step_dx);
- if (height & 1) {
+ if (!(height & 1)) {
pu += uv_stride;
pv += uv_stride;
@@ -553,8 +557,7 @@ static inline void yuv420_rgb15 (yuv2rgb_t *this,
this->dest_width >> 1, this->step_dx);
}
- height--;
- } while (height>0);
+ }
}
}
@@ -609,7 +612,7 @@ static inline void yuv420_rgb24 (yuv2rgb_t *this,
scale_line (py, this->y_buffer,
this->dest_width, this->step_dx);
- do {
+ for (;;) {
y_buf = this->y_buffer;
u_buf = this->u_buffer;
@@ -633,21 +636,22 @@ static inline void yuv420_rgb24 (yuv2rgb_t *this,
while (dy <= 32768) {
- memcpy (image, image-rgb_stride, this->dest_width*4);
+ memcpy (image, image-rgb_stride, this->dest_width*3);
dy += this->step_dy;
image += rgb_stride;
}
+ if (--height <= 0)
+ break;
dy -= 32768;
-
py += y_stride;
scale_line (py, this->y_buffer,
this->dest_width, this->step_dx);
- if (height & 1) {
+ if (!(height & 1)) {
pu += uv_stride;
pv += uv_stride;
@@ -656,9 +660,8 @@ static inline void yuv420_rgb24 (yuv2rgb_t *this,
scale_line (pv, this->v_buffer,
this->dest_width >> 1, this->step_dx);
}
- height--;
- } while (height>0);
+ }
}
}
@@ -714,7 +717,7 @@ static inline void yuv420_argb32 (yuv2rgb_t *this,
scale_line (py, this->y_buffer,
this->dest_width, this->step_dx);
- do {
+ for (;;) {
y_buf = this->y_buffer;
u_buf = this->u_buffer;
@@ -744,15 +747,16 @@ static inline void yuv420_argb32 (yuv2rgb_t *this,
image += rgb_stride;
}
+ if (--height <= 0)
+ break;
dy -= 32768;
-
py += y_stride;
scale_line (py, this->y_buffer,
this->dest_width, this->step_dx);
- if (height & 1) {
+ if (!(height & 1)) {
pu += uv_stride;
pv += uv_stride;
@@ -761,9 +765,8 @@ static inline void yuv420_argb32 (yuv2rgb_t *this,
scale_line (pv, this->v_buffer,
this->dest_width >> 1, this->step_dx);
}
- height--;
- } while (height>0);
+ }
}
}
diff --git a/src/xine-engine/utils.c b/src/xine-engine/utils.c
index 3c6c0f532..50d5cc482 100644
--- a/src/xine-engine/utils.c
+++ b/src/xine-engine/utils.c
@@ -17,9 +17,11 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: utils.c,v 1.1 2001/04/18 22:36:04 f1rmb Exp $
+ * $Id: utils.c,v 1.2 2001/06/21 17:34:24 guenter Exp $
*
*/
+#define _POSIX_PTHREAD_SEMANTICS 1 /* for 5-arg getpwuid_r on solaris */
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c
index 2c624b94d..b497799ce 100644
--- a/src/xine-engine/video_out.c
+++ b/src/xine-engine/video_out.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: video_out.c,v 1.24 2001/06/18 15:43:01 richwareham Exp $
+ * $Id: video_out.c,v 1.25 2001/06/21 17:34:24 guenter Exp $
*
*/
@@ -130,9 +130,9 @@ static void vo_set_timer (uint32_t video_step) {
}
void video_timer_handler (int hubba) {
-
+#if !HAVE_SIGACTION
signal (SIGALRM, video_timer_handler);
-
+#endif
}
static void *video_out_loop (void *this_gen) {
@@ -152,7 +152,7 @@ static void *video_out_loop (void *this_gen) {
/*
sigemptyset(&vo_mask);
sigaddset(&vo_mask, SIGALRM);
- pthread_sigmask(SIG_BLOCK, &vo_mask, NULL);
+ pthread_sigmask(SIG_UNBLOCK, &vo_mask, NULL);
*/
@@ -161,9 +161,17 @@ static void *video_out_loop (void *this_gen) {
if (sigprocmask (SIG_UNBLOCK, &vo_mask, NULL)) {
printf ("video_out: sigprocmask failed.\n");
}
+#if HAVE_SIGACTION
+ {
+ struct sigaction sig_act;
+ memset (&sig_act, 0, sizeof(sig_act));
+ sig_act.sa_handler = video_timer_handler;
+ sigaction (SIGALRM, &sig_act, NULL);
+ }
+#else
signal (SIGALRM, video_timer_handler);
-
-
+#endif
+
video_step = this->metronom->get_video_rate (this->metronom);
/*
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index d2aef0dc4..eb08a1e7b 100644
--- a/src/xine-engine/xine.c
+++ b/src/xine-engine/xine.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: xine.c,v 1.28 2001/06/18 15:43:01 richwareham Exp $
+ * $Id: xine.c,v 1.29 2001/06/21 17:34:24 guenter Exp $
*
* top-level xine functions
*
@@ -351,7 +351,7 @@ void xine_pause (xine_t *this) {
pthread_mutex_unlock (&this->xine_lock);
- printf ("pausing at %d\n", this->cur_input_pos);
+ printf ("pausing at %Ld\n", this->cur_input_pos);
xine_stop (this);