Support both flac-1.1.2 and flac-1.1.3+ updates, which removes net/ices as

a stumbling block for audio/flac updates. Identical to what is currently in
the upstream repository. Regen patches while here.

ok naddy@
This commit is contained in:
mgrimm 2007-09-08 16:25:06 +00:00
parent 020bc402d3
commit 91005d0bd1
3 changed files with 109 additions and 6 deletions

View File

@ -1,9 +1,9 @@
# $OpenBSD: Makefile,v 1.11 2007/07/21 08:09:31 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.12 2007/09/08 16:25:06 mgrimm Exp $
COMMENT= icecast source for streaming MP3
DISTNAME= ices-0.4
PKGNAME= ${DISTNAME}p2
PKGNAME= ${DISTNAME}p3
CATEGORIES= net audio
HOMEPAGE= http://www.icecast.org/ices.php

View File

@ -0,0 +1,103 @@
$OpenBSD: patch-src_in_flac_c,v 1.1 2007/09/08 16:25:06 mgrimm Exp $
--- src/in_flac.c.orig Sat Jul 31 19:52:24 2004
+++ src/in_flac.c Fri Sep 7 20:26:12 2007
@@ -40,14 +40,19 @@ typedef struct {
} flac_in_t;
/* -- static prototypes -- */
-static int ices_flac_readpcm (input_stream_t* self, size_t len,
- int16_t* left, int16_t* right);
+static ssize_t ices_flac_readpcm (input_stream_t* self, size_t len,
+ int16_t* left, int16_t* right);
static int ices_flac_close (input_stream_t* self);
/* -- FLAC callbacks -- */
+#if !defined(FLAC_API_VERSION_CURRENT) || FLAC_API_VERSION_CURRENT <= 7
+# define FLAC_BUFSIZE_TYPE unsigned
+#else
+# define FLAC_BUFSIZE_TYPE size_t
+#endif /* !FLAC_API_VERSION_CURRENT || FLAC_API_VERSION_CURRENT <= 7 */
static FLAC__StreamDecoderReadStatus
flac_read_cb(const FLAC__StreamDecoder* decoder, FLAC__byte buffer[],
- unsigned* bytes, void* client_data);
+ FLAC_BUFSIZE_TYPE* bytes, void* client_data);
static FLAC__StreamDecoderWriteStatus
flac_write_cb(const FLAC__StreamDecoder* decoder, const FLAC__Frame* frame,
const FLAC__int32* const buffer[], void* client_data);
@@ -76,18 +81,39 @@ ices_flac_open (input_stream_t* self, char* buf, size_
return -1;
}
+#if !defined(FLAC_API_VERSION_CURRENT) || FLAC_API_VERSION_CURRENT <= 7
FLAC__stream_decoder_set_read_callback(decoder, flac_read_cb);
FLAC__stream_decoder_set_write_callback(decoder, flac_write_cb);
FLAC__stream_decoder_set_metadata_callback(decoder, flac_metadata_cb);
FLAC__stream_decoder_set_error_callback(decoder, flac_error_cb);
+ FLAC__stream_decoder_set_client_data(decoder, self);
+ switch (FLAC__stream_decoder_init(decoder)) {
+ case FLAC__STREAM_DECODER_SEARCH_FOR_METADATA:
+ break;
+ case FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR:
+ ices_log_error("Could not allocate memory during FLAC decoder init");
+ goto errDecoder;
+ default:
+ ices_log_error("Unexpected error during FLAC decoder init");
+ goto errDecoder;
+ }
+#else
+ if (FLAC__stream_decoder_init_stream(decoder, flac_read_cb, NULL, NULL, NULL,
+ NULL, flac_write_cb, flac_metadata_cb,
+ flac_error_cb, self)
+ != FLAC__STREAM_DECODER_INIT_STATUS_OK) {
+ ices_log_error("ices_flac_open: Error initializing FLAC decoder");
+ goto errDecoder;
+ }
+#endif /* !FLAC_API_VERSION_CURRENT || FLAC_API_VERSION_CURRENT <= 7 */
+
FLAC__stream_decoder_set_metadata_respond(decoder, FLAC__METADATA_TYPE_VORBIS_COMMENT);
if (!(flac_data = (flac_in_t*)malloc (sizeof (flac_in_t)))) {
ices_log_error ("Malloc failed in ices_flac_open");
goto errDecoder;
}
- FLAC__stream_decoder_set_client_data(decoder, self);
flac_data->decoder = decoder;
flac_data->parsed = 0;
@@ -96,17 +122,6 @@ ices_flac_open (input_stream_t* self, char* buf, size_
self->data = flac_data;
- switch (FLAC__stream_decoder_init(decoder)) {
- case FLAC__STREAM_DECODER_SEARCH_FOR_METADATA:
- break;
- case FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR:
- ices_log_error("Could not allocate memory during FLAC decoder init");
- goto errData;
- default:
- ices_log_error("Unexpected error during FLAC decoder init");
- goto errData;
- }
-
if (!FLAC__stream_decoder_process_single(decoder)) {
ices_log_error("Could not find FLAC metadata header");
free(flac_data);
@@ -141,7 +156,7 @@ errDecoder:
return -1;
}
-static int
+static ssize_t
ices_flac_readpcm (input_stream_t* self, size_t olen, int16_t* left,
int16_t* right)
{
@@ -179,7 +194,7 @@ ices_flac_close (input_stream_t* self)
/* -- callbacks -- */
static FLAC__StreamDecoderReadStatus
flac_read_cb(const FLAC__StreamDecoder* decoder, FLAC__byte buffer[],
- unsigned* bytes, void* client_data)
+ FLAC_BUFSIZE_TYPE* bytes, void* client_data)
{
input_stream_t* self = (input_stream_t*)client_data;
flac_in_t* flac_data = (flac_in_t*)self->data;

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-src_in_vorbis_c,v 1.3 2006/03/14 20:00:20 sturm Exp $
$OpenBSD: patch-src_in_vorbis_c,v 1.4 2007/09/08 16:25:06 mgrimm Exp $
--- src/in_vorbis.c.orig Mon Mar 22 04:13:13 2004
+++ src/in_vorbis.c Sat Jan 28 13:23:02 2006
+++ src/in_vorbis.c Fri Sep 7 19:18:46 2007
@@ -44,7 +44,7 @@ typedef struct {
} ices_vorbis_in_t;
@ -10,7 +10,7 @@ $OpenBSD: patch-src_in_vorbis_c,v 1.3 2006/03/14 20:00:20 sturm Exp $
int16_t* left, int16_t* right);
static int ices_vorbis_close (input_stream_t* self);
static void in_vorbis_parse (input_stream_t* self);
@@ -133,13 +133,13 @@ ices_vorbis_open (input_stream_t* self,
@@ -133,13 +133,13 @@ ices_vorbis_open (input_stream_t* self, char* buf, siz
return 0;
}
@ -26,7 +26,7 @@ $OpenBSD: patch-src_in_vorbis_c,v 1.3 2006/03/14 20:00:20 sturm Exp $
int i;
/* refill buffer if necessary */
@@ -150,6 +150,9 @@ ices_vorbis_readpcm (input_stream_t* sel
@@ -150,6 +150,9 @@ ices_vorbis_readpcm (input_stream_t* self, size_t olen
sizeof (vorbis_data->buf), ICES_OV_BE, SAMPLESIZE, 1, &link)) <= 0) {
if (len == OV_HOLE) {
ices_log_error ("Skipping bad vorbis data");