summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuenter Bartsch <guenter@users.sourceforge.net>2001-07-26 19:12:21 +0000
committerGuenter Bartsch <guenter@users.sourceforge.net>2001-07-26 19:12:21 +0000
commitef274e552e7bc0cba8dc9879796d20a591969d19 (patch)
treecc56b803f30d9cbedbda5c236a0372b408a2c92f
parent47c63bc46535f61eea6f036902fa1c37828e5bb8 (diff)
downloadxine-lib-ef274e552e7bc0cba8dc9879796d20a591969d19.tar.gz
xine-lib-ef274e552e7bc0cba8dc9879796d20a591969d19.tar.bz2
PPC patches by Bill Fink
CVS patchset: 355 CVS date: 2001/07/26 19:12:21
-rw-r--r--AUTHORS3
-rw-r--r--acconfig.h3
-rw-r--r--configure.in13
-rw-r--r--src/audio_out/audio_oss_out.c52
4 files changed, 64 insertions, 7 deletions
diff --git a/AUTHORS b/AUTHORS
index 329138789..1d384e7cb 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -107,6 +107,9 @@ Contributions
Jérôme Villette <villette@chem.leidenuniv.nl>
'xinetic' skin.
+ Bill Fink <billfink@capu.net>
+ powerpc patches
+
(let us know if we've forgotten anyone)
diff --git a/acconfig.h b/acconfig.h
index 9b15a85b7..95a218b76 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -78,3 +78,6 @@
/* Define this if you have ip_mreqn in netinet/in.h */
#undef HAVE_IP_MREQN
+/* Define this to cap audio sample rate at 44.1K, some drivers (dmasound) don't handle 48K request correctly */
+#undef FORCE_44K_MAX
+
diff --git a/configure.in b/configure.in
index 70df6e43d..154914610 100644
--- a/configure.in
+++ b/configure.in
@@ -430,6 +430,7 @@ case $host in
ppc-*-linux-* | powerpc-*)
GLOBAL_CFLAGS="$GLOBAL_CFLAGS -O3 -pipe -fomit-frame-pointer $m_wm $m_psb -fexpensive-optimizations $f_si $f_nsa -ffast-math -funroll-loops -funroll-all-loops -finline-functions"
DEBUG_CFLAGS="$DEBUG_CFLAGS -O3"
+ FORCE_44K_MAX=yes
;;
sparc64-*-linux-* | sparc-*)
dnl hard code cpu target as sparcv8, hopefully no one wants to watch
@@ -508,6 +509,18 @@ AC_SUBST(w32_path)
dnl
+dnl Force 44.1K maximum audio sample rate for drivers/devices that don't
+dnl correctly handle 48K rates, e.g. PowerMac dmasound through at least
+dnl early 2.4.*. Will need dynamic test once fix makes it into source
+dnl trees.
+dnl
+if test x$FORCE_44K_MAX = xyes; then
+ echo "including FORCE_44K_MAX capping"
+ AC_DEFINE(FORCE_44K_MAX,1,[Cap audio sample rate at 44.1K, some drivers (dmasound) don't handle 48K request correctly])
+fi
+
+
+dnl
dnl Some include paths ( !!! DO NOT REMOVE !!! )
dnl
INCLUDES='-I$(top_srcdir) -I$(top_builddir) -I$(top_srcdir)/src -I$(top_builddir)/src -I$(top_srcdir)/src/xine-engine -I$(top_builddir)/src/xine-engine'
diff --git a/src/audio_out/audio_oss_out.c b/src/audio_out/audio_oss_out.c
index 21a6fb833..900feb8a0 100644
--- a/src/audio_out/audio_oss_out.c
+++ b/src/audio_out/audio_oss_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: audio_oss_out.c,v 1.23 2001/07/22 14:18:22 ehasenle Exp $
+ * $Id: audio_oss_out.c,v 1.24 2001/07/26 19:12:21 guenter Exp $
*/
/* required for swab() */
@@ -83,6 +83,8 @@
#define DSP_TEMPLATE "/dev/dsp%d"
#endif
+static int checked_getoptr = 0;
+
typedef struct oss_functions_s {
ao_functions_t ao_functions;
@@ -107,6 +109,7 @@ typedef struct oss_functions_s {
int16_t *zero_space;
int audio_started;
+ int audio_has_realtime; /* OSS driver supports real-time */
uint32_t last_audio_vpts;
int resample_conf;
int do_resample;
@@ -169,6 +172,10 @@ static int ao_open(ao_functions_t *this_gen,
ioctl(this->audio_fd,SNDCTL_DSP_SAMPLESIZE,&tmp);
tmp = this->input_sample_rate;
+#ifdef FORCE_44K_MAX
+ if(tmp > 44100)
+ tmp = 44100;
+#endif
ioctl(this->audio_fd,SNDCTL_DSP_SPEED, &tmp);
this->output_sample_rate = tmp;
@@ -245,6 +252,23 @@ static int ao_open(ao_functions_t *this_gen,
ioctl(this->audio_fd,SNDCTL_DSP_SETFRAGMENT,&tmp);
*/
+ /*
+ * Final check of realtime capability, make sure GETOPTR
+ * doesn't return an error.
+ */
+ if ( this->audio_has_realtime && !checked_getoptr ) {
+ count_info info;
+ int ret = ioctl(this->audio_fd, SNDCTL_DSP_GETOPTR, &info);
+ if ( ret == -1 && errno == EINVAL ) {
+ this->audio_has_realtime = 0;
+ printf("audio_oss_out: Audio driver SNDCTL_DSP_GETOPTR reports %s,"
+ " disabling realtime sync...\n", strerror(errno) );
+ printf("audio_oss_out: ...Will use video master clock for soft-sync instead\n");
+ printf("audio_oss_out: ...There may be audio/video synchronization issues\n");
+ }
+ checked_getoptr = 1;
+ }
+
switch (this->resample_conf) {
case 1: /* force off */
this->do_resample = 0;
@@ -252,6 +276,9 @@ static int ao_open(ao_functions_t *this_gen,
this->do_resample = 1;
default: /* AUTO */
this->do_resample = this->output_sample_rate != this->input_sample_rate;
+ if (this->do_resample)
+ printf("audio_oss_out: will resample audio from %d to %d\n",
+ this->input_sample_rate, this->output_sample_rate);
}
return 1;
@@ -312,6 +339,10 @@ static int ao_write_audio_data(ao_functions_t *this_gen,
this->last_audio_vpts = vpts;
+ bDropPackage = 0;
+
+ if ( this->audio_has_realtime || !this->audio_started ) {
+
/*
* where, in the timeline is the "end" of the audio buffer at the moment?
*/
@@ -337,8 +368,6 @@ static int ao_write_audio_data(ao_functions_t *this_gen,
xprintf (VERBOSE|AUDIO, "audio_oss_out: buff=%d pos=%d buf_vpts=%d gap=%d\n",
this->bytes_in_buffer, pos,buffer_vpts,gap);
- bDropPackage = 0;
-
if (gap>GAP_TOLERANCE) {
ao_fill_gap (this, gap);
@@ -349,8 +378,12 @@ static int ao_write_audio_data(ao_functions_t *this_gen,
} else if (gap<-GAP_TOLERANCE) {
bDropPackage = 1;
+ xprintf (VERBOSE|AUDIO, "audio_oss_out: audio package (vpts = %d %d)"
+ "dropped\n", vpts, gap);
}
+ } /* has realtime */
+
/*
* resample and output samples
*/
@@ -412,9 +445,6 @@ static int ao_write_audio_data(ao_functions_t *this_gen,
this->bytes_in_buffer += num_output_samples * 2 * this->num_channels;
this->audio_started = 1;
- } else {
- xprintf (VERBOSE|AUDIO, "audio_oss_out: audio package (vpts = %d %d)"
- "dropped\n", vpts, gap);
}
return 1;
@@ -574,8 +604,16 @@ ao_functions_t *init_audio_out_plugin (config_values_t *config) {
if ((caps & DSP_CAP_REALTIME) > 0) {
xprintf (VERBOSE|AUDIO, "audio_oss_out : realtime check: passed :-)\n");
+ this->audio_has_realtime = 1;
} else {
- xprintf (VERBOSE|AUDIO, "audio_oss_out : realtime check: *FAILED* :-(((((\n\n");
+ printf ("audio_oss_out : realtime check: *FAILED* :-(((((\n");
+ this->audio_has_realtime = 0;
+ }
+
+ if( !this->audio_has_realtime ) {
+ printf("audio_oss_out: Audio driver realtime sync disabled...\n");
+ printf("audio_oss_out: ...Will use video master clock for soft-sync instead\n");
+ printf("audio_oss_out: ...There may be audio/video synchronization issues\n");
}
this->capabilities = 0;