ports/156747: multimedia/mplayer: fix 24-bits OSS + some improvements
Pan Tsu
inyaoo at gmail.com
Sun May 1 07:40:13 UTC 2011
The following reply was made to PR ports/156747; it has been noted by GNATS.
From: Pan Tsu <inyaoo at gmail.com>
To: Zhihao Yuan <lichray at gmail.com>
Cc: bug-followup at FreeBSD.org
Subject: Re: ports/156747: multimedia/mplayer: fix 24-bits OSS + some improvements
Date: Sun, 01 May 2011 11:32:36 +0400
Zhihao Yuan <lichray at gmail.com> writes:
> mplayer does not detects 24-bits OSS correctly. It only
> detects AFMT_S24_PACKED, which is not available for the OSS on
> FreeBSD.
[...]
> +@@ -72,6 +72,10 @@ static int format2oss(int format)
> + case AF_FORMAT_S16_BE: return AFMT_S16_BE;
> + #ifdef AFMT_S24_PACKED
> + case AF_FORMAT_S24_LE: return AFMT_S24_PACKED;
> ++#elif defined(AFMT_S24_LE) && defined(__FreeBSD__)
> ++ case AF_FORMAT_S24_LE: return AFMT_S24_LE;
> ++#elif defined(AFMT_S24_BE) && defined(__FreeBSD__)
> ++ case AF_FORMAT_S24_BE: return AFMT_S24_BE;
Only signed 24bit formats? They do not seem to be specific to our OSS
implementation.
$ cd audio/oss; make extract
$ fgrep -lr AFMT_S24_LE $(make -V WRKDIR)
[...]
WRKDIR/oss-v4.2-build2004-src-bsd/include/soundcard.h
Not so for unsigned (*_U24_*) which are supported by libaf, too.
But they're similar to AFMT_U32_(LE|BE) that are used by ao_oss
*without* __FreeBSD__ ifdef around them.
And because AFMT_S24_(LE|BE) are defined unconditionally on both little-
and big-endian systems only the first match would be compiled in,
i.e. only AFMT_S24_LE. How about below patch?
> + #endif
> + #ifdef AFMT_U32_LE
> + case AF_FORMAT_U32_LE: return AFMT_U32_LE;
> +@@ -115,6 +119,10 @@ static int oss2format(int format)
> + case AFMT_S16_BE: return AF_FORMAT_S16_BE;
> + #ifdef AFMT_S24_PACKED
> + case AFMT_S24_PACKED: return AF_FORMAT_S24_LE;
> ++#elif defined(AFMT_S24_LE) && defined(__FreeBSD__)
> ++ case AFMT_S24_LE: return AF_FORMAT_S24_LE;
> ++#elif defined(AFMT_S24_BE) && defined(__FreeBSD__)
> ++ case AFMT_S24_BE: return AF_FORMAT_S24_BE;
> + #endif
> + #ifdef AFMT_U32_LE
> + case AFMT_U32_LE: return AF_FORMAT_U32_LE;
> +@@ -448,6 +456,7 @@ static void reset(void){
--- a.diff begins here ---
Index: multimedia/mplayer/files/patch-libao2-ao_oss.c
===================================================================
RCS file: /a/.cvsup/ports/multimedia/mplayer/files/patch-libao2-ao_oss.c,v
retrieving revision 1.4
diff -u -p -r1.4 patch-libao2-ao_oss.c
--- multimedia/mplayer/files/patch-libao2-ao_oss.c 21 Apr 2010 13:07:22 -0000 1.4
+++ multimedia/mplayer/files/patch-libao2-ao_oss.c 1 May 2011 07:26:38 -0000
@@ -1,5 +1,43 @@
--- libao2/ao_oss.c.orig 2009-05-12 21:58:57.000000000 -0500
+++ libao2/ao_oss.c 2009-07-23 19:58:44.870097203 -0500
+@@ -72,6 +72,18 @@ static int format2oss(int format)
+ #ifdef AFMT_S24_PACKED
+ case AF_FORMAT_S24_LE: return AFMT_S24_PACKED;
+ #endif
++#ifdef AFMT_U24_LE
++ case AF_FORMAT_U24_LE: return AFMT_U24_LE;
++#endif
++#ifdef AFMT_U24_BE
++ case AF_FORMAT_U24_BE: return AFMT_U24_BE;
++#endif
++#ifdef AFMT_S24_LE
++ case AF_FORMAT_S24_LE: return AFMT_S24_LE;
++#endif
++#ifdef AFMT_S24_BE
++ case AF_FORMAT_S24_BE: return AFMT_S24_BE;
++#endif
+ #ifdef AFMT_U32_LE
+ case AF_FORMAT_U32_LE: return AFMT_U32_LE;
+ #endif
+@@ -115,6 +127,18 @@ static int oss2format(int format)
+ #ifdef AFMT_S24_PACKED
+ case AFMT_S24_PACKED: return AF_FORMAT_S24_LE;
+ #endif
++#ifdef AFMT_U24_LE
++ case AFMT_U24_LE: return AF_FORMAT_U24_LE;
++#endif
++#ifdef AFMT_U24_BE
++ case AFMT_U24_BE: return AF_FORMAT_U24_BE;
++#endif
++#ifdef AFMT_S24_LE
++ case AFMT_S24_LE: return AF_FORMAT_S24_LE;
++#endif
++#ifdef AFMT_S24_BE
++ case AFMT_S24_BE: return AF_FORMAT_S24_BE;
++#endif
+ #ifdef AFMT_U32_LE
+ case AFMT_U32_LE: return AF_FORMAT_U32_LE;
+ #endif
@@ -453,6 +453,7 @@
fcntl(audio_fd, F_SETFD, FD_CLOEXEC);
#endif
--- a.diff ends here ---
More information about the freebsd-ports-bugs
mailing list