let SDL do the audio conversions as smpeg doesn't do them very well

ok pvalchev
This commit is contained in:
jakemsr 2009-01-25 01:25:39 +00:00
parent 8b03888204
commit 7398d6cd1a
2 changed files with 42 additions and 6 deletions

View File

@ -1,9 +1,9 @@
# $OpenBSD: Makefile,v 1.28 2009/01/09 17:43:38 naddy Exp $ # $OpenBSD: Makefile,v 1.29 2009/01/25 01:25:39 jakemsr Exp $
COMMENT= mpeg video player library with sound support COMMENT= mpeg video player library with sound support
DISTNAME= smpeg-0.4.4 DISTNAME= smpeg-0.4.4
PKGNAME= ${DISTNAME}p7 PKGNAME= ${DISTNAME}p8
SHARED_LIBS= smpeg 2.0 SHARED_LIBS= smpeg 2.0
CATEGORIES= devel graphics CATEGORIES= devel graphics

View File

@ -1,7 +1,43 @@
$OpenBSD: patch-audio_MPEGaudio_cpp,v 1.1 2002/06/08 09:21:19 pvalchev Exp $ $OpenBSD: patch-audio_MPEGaudio_cpp,v 1.2 2009/01/25 01:25:39 jakemsr Exp $
--- audio/MPEGaudio.cpp.orig Wed Apr 4 15:42:40 2001 --- audio/MPEGaudio.cpp.orig Wed Apr 4 13:42:40 2001
+++ audio/MPEGaudio.cpp Sat Jun 8 04:15:54 2002 +++ audio/MPEGaudio.cpp Sat Jan 24 04:31:08 2009
@@ -200,9 +200,11 @@ void @@ -54,10 +54,16 @@ MPEGaudio:: MPEGaudio(MPEGstream *stream, bool initSDL
if ( sdl_audio ) {
/* Open the audio, get actual audio hardware format and convert */
bool audio_active;
+#ifdef DISABLE_SDL_CONVERSIONS
SDL_AudioSpec actual;
audio_active = (SDL_OpenAudio(&wanted, &actual) == 0);
if ( audio_active ) {
ActualSpec(&actual);
+#else
+ audio_active = (SDL_OpenAudio(&wanted, NULL) == 0);
+ if ( audio_active ) {
+ ActualSpec(&wanted);
+#endif
valid_stream = true;
} else {
SetError(SDL_GetError());
@@ -112,6 +118,8 @@ MPEGaudio:: WantedSpec(SDL_AudioSpec *wanted)
void
MPEGaudio:: ActualSpec(const SDL_AudioSpec *actual)
{
+#ifdef DISABLE_SDL_CONVERSIONS
+
/* Splay can optimize some of the conversion */
if ( actual->channels == 1 && outputstereo ) {
forcetomonoflag = true;
@@ -131,6 +139,9 @@ MPEGaudio:: ActualSpec(const SDL_AudioSpec *actual)
;
#endif
}
+
+#endif /* DISABLE_SDL_CONVERSIONS */
+
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
if ( actual->format != AUDIO_S16LSB)
#else
@@ -200,9 +211,11 @@ void
MPEGaudio:: Stop(void) MPEGaudio:: Stop(void)
{ {
if ( valid_stream ) { if ( valid_stream ) {