sbc: added a recipe for version 1.3

This commit is contained in:
Jerome Duval
2015-01-13 21:44:32 +00:00
parent 6525483111
commit 471fab2f26
2 changed files with 247 additions and 0 deletions

View File

@@ -0,0 +1,146 @@
From 6d238064d1df3161a1bd43236ac3d29ea9b595c9 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Tue, 13 Jan 2015 20:57:54 +0000
Subject: Haiku patch
diff --git a/sbc/sbc.c b/sbc/sbc.c
index 606f11c..6bee729 100644
--- a/sbc/sbc.c
+++ b/sbc/sbc.c
@@ -29,6 +29,7 @@
#include <config.h>
#endif
+#include <stdint.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
diff --git a/src/formats.h b/src/formats.h
index 3050b25..dd7aba2 100644
--- a/src/formats.h
+++ b/src/formats.h
@@ -21,18 +21,32 @@
*
*/
+#ifdef __HAIKU__
+#include <ByteOrder.h>
+#else
#include <byteswap.h>
+#endif
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define COMPOSE_ID(a,b,c,d) ((a) | ((b)<<8) | ((c)<<16) | ((d)<<24))
#define LE_SHORT(v) (v)
#define LE_INT(v) (v)
+#ifdef __HAIKU__
+#define BE_SHORT(v) B_SWAP_INT16(v)
+#define BE_INT(v) B_SWAP_INT32(v)
+#else
#define BE_SHORT(v) bswap_16(v)
#define BE_INT(v) bswap_32(v)
+#endif
#elif __BYTE_ORDER == __BIG_ENDIAN
#define COMPOSE_ID(a,b,c,d) ((d) | ((c)<<8) | ((b)<<16) | ((a)<<24))
+#ifdef __HAIKU__
+#define LE_SHORT(v) B_SWAP_INT16(v)
+#define LE_INT(v) B_SWAP_INT32(v)
+#else
#define LE_SHORT(v) bswap_16(v)
#define LE_INT(v) bswap_32(v)
+#endif
#define BE_SHORT(v) (v)
#define BE_INT(v) (v)
#else
diff --git a/src/sbcdec.c b/src/sbcdec.c
index ba17f7a..9cda0c4 100644
--- a/src/sbcdec.c
+++ b/src/sbcdec.c
@@ -37,7 +37,9 @@
#include <getopt.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
+#ifndef __HAIKU__
#include <sys/soundcard.h>
+#endif
#include "sbc/sbc.h"
#include "formats.h"
@@ -53,7 +55,11 @@ static void decode(char *filename, char *output, int tofile, bool msbc)
sbc_t sbc;
int fd, ad, pos, streamlen, framelen, count;
size_t len;
+#ifndef __HAIKU__
int format = AFMT_S16_BE, frequency, channels;
+#else
+ int frequency, channels;
+#endif
ssize_t written;
if (stat(filename, &st) < 0) {
@@ -154,6 +160,7 @@ static void decode(char *filename, char *output, int tofile, bool msbc)
goto close;
}
} else {
+#ifndef __HAIKU__
if (ioctl(ad, SNDCTL_DSP_SETFMT, &format) < 0) {
fprintf(stderr, "Can't set audio format on %s: %s\n",
output, strerror(errno));
@@ -171,6 +178,7 @@ static void decode(char *filename, char *output, int tofile, bool msbc)
output, strerror(errno));
goto close;
}
+#endif
}
count = len;
@@ -233,7 +241,9 @@ static void usage(void)
printf("Options:\n"
"\t-h, --help Display help\n"
+#ifndef __HAIKU__
"\t-d, --device <dsp> Sound device\n"
+#endif
"\t-v, --verbose Verbose mode\n"
"\t-m, --msbc mSBC codec\n"
"\t-f, --file <file> Decode to a file\n"
@@ -243,7 +253,9 @@ static void usage(void)
static struct option main_options[] = {
{ "help", 0, 0, 'h' },
{ "msbc", 0, 0, 'm' },
+#ifndef __HAIKU__
{ "device", 1, 0, 'd' },
+#endif
{ "verbose", 0, 0, 'v' },
{ "file", 1, 0, 'f' },
{ 0, 0, 0, 0 }
@@ -252,7 +264,11 @@ static struct option main_options[] = {
int main(int argc, char *argv[])
{
char *output = NULL;
+#ifndef __HAIKU__
int i, opt, tofile = 0;
+#else
+ int i, opt, tofile = 1;
+#endif
bool msbc = false;
while ((opt = getopt_long(argc, argv, "+hmvd:f:",
@@ -270,11 +286,13 @@ int main(int argc, char *argv[])
msbc = true;
break;
+#ifndef __HAIKU__
case 'd':
free(output);
output = strdup(optarg);
tofile = 0;
break;
+#endif
case 'f' :
free(output);
--
1.8.3.4

View File

@@ -0,0 +1,101 @@
SUMMARY="An audio codec to connect Bluetooth audio devices"
DESCRIPTION="
SBC is an audio subband codec specified by the Bluetooth Special Interest Group
for the A2DP profile. SBC is a digital audio encoder and decoder used to
transfer date to Bluetooth audio output devcies likes headphones or
loudspeakers. It can be also used on the Internet. It was designed to obtain
a reasonably good audio quality at medium bit rates while keeping low
computational complexity, having Bluetooth bandwidth limitations and processing
power in mind.
"
HOMEPAGE="http://www.bluez.org"
COPYRIGHT="
2004-2010 Marcel Holtmann
2008-2010 Nokia Corporation
2012-2013 Intel Corporation
2007-2008 Frederic Dalleau
"
LICENSE="GNU GPL v2
GNU LGPL v2.1"
SRC_URI="http://www.kernel.org/pub/linux/bluetooth/sbc-$portVersion.tar.gz"
CHECKSUM_SHA256="4a358581fb57b98e0c1c34606a35343f31f908f57c26659e51495f75e283785d"
REVISION="1"
ARCHITECTURES="x86 x86_64"
SECONDARY_ARCHITECTURES="x86"
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
# x86_gcc2 is fine as primary target architecture as long as we're building
# for a different secondary architecture.
ARCHITECTURES="$ARCHITECTURES x86_gcc2"
fi
PATCHES="sbc-$portVersion.patchset"
PROVIDES="
sbc$secondaryArchSuffix = $portVersion compat >= 1
lib:libsbc$secondaryArchSuffix = 1.2.1 compat >= 1
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libsndfile$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libsndfile$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:aclocal
cmd:autoconf
cmd:automake
cmd:gcc$secondaryArchSuffix
cmd:ld$secondaryArchSuffix
cmd:pkg_config$secondaryArchSuffix
cmd:libtoolize
cmd:make
"
BUILD()
{
autoreconf -fi
runConfigure ./configure
make $jobArgs
}
INSTALL()
{
make install
prepareInstalledDevelLibs libsbc
fixPkgconfig
# devel package
packageEntries devel \
$developDir
# tools package
packageEntries tools \
$binDir
}
# ----- devel package -------------------------------------------------------
PROVIDES_devel="
sbc${secondaryArchSuffix}_devel = $portVersion compat >= 1
devel:libsbc$secondaryArchSuffix = 1.2.1 compat >= 1
"
REQUIRES_devel="
sbc$secondaryArchSuffix == $portVersion base
"
# ----- tools package -------------------------------------------------------
SUMMARY_tools="The SBC tools"
PROVIDES_tools="
sbc_tools$secondaryArchSuffix = $portVersion compat >= 1
cmd:sbcdec = $portVersion compat >= 1
cmd:sbcenc = $portVersion compat >= 1
cmd:sbcinfo = $portVersion compat >= 1
"
REQUIRES_tools="
haiku$secondaryArchSuffix
sbc$secondaryArchSuffix == $portVersion base
"