pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/audio Support flac-1.1.3 using a patch from



details:   https://anonhg.NetBSD.org/pkgsrc/rev/61a77ed390c1
branches:  trunk
changeset: 523730:61a77ed390c1
user:      wiz <wiz%pkgsrc.org@localhost>
date:      Fri Jan 12 20:21:47 2007 +0000

description:
Support flac-1.1.3 using a patch from
ftp.altlinux.org /pub/people/thresh

diffstat:

 audio/libtunepimp0.4/distinfo         |    4 +-
 audio/libtunepimp0.4/patches/patch-af |   50 +++++
 audio/libtunepimp0.4/patches/patch-ag |   16 +
 audio/moc/distinfo                    |    3 +-
 audio/moc/patches/patch-aa            |  307 ++++++++++++++++++++++++++++++++++
 5 files changed, 378 insertions(+), 2 deletions(-)

diffs (truncated from 411 to 300 lines):

diff -r da8056a079dd -r 61a77ed390c1 audio/libtunepimp0.4/distinfo
--- a/audio/libtunepimp0.4/distinfo     Fri Jan 12 20:16:04 2007 +0000
+++ b/audio/libtunepimp0.4/distinfo     Fri Jan 12 20:21:47 2007 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.2 2006/08/21 17:55:01 salo Exp $
+$NetBSD: distinfo,v 1.3 2007/01/12 20:21:47 wiz Exp $
 
 SHA1 (libtunepimp-0.4.2.tar.gz) = deb7ac22e451b7512006e6f090333e14d4cbc78f
 RMD160 (libtunepimp-0.4.2.tar.gz) = f4c7ebeb505c6b8b1dff284aebf6c9e249192765
@@ -8,3 +8,5 @@
 SHA1 (patch-ac) = bebb5ac1358007098704052888a98f9d97376b6a
 SHA1 (patch-ad) = cdd662177cf90a9e926881d25eb40d674ca21456
 SHA1 (patch-ae) = eb8cfcbb6672c241f14666d77b48bd16ef3a9875
+SHA1 (patch-af) = 91401702a2b327d8f84b1fdfc73847b047c2d49a
+SHA1 (patch-ag) = 1f11eb74fcdc47b02e59e8dba4f8e6491f823afb
diff -r da8056a079dd -r 61a77ed390c1 audio/libtunepimp0.4/patches/patch-af
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/audio/libtunepimp0.4/patches/patch-af     Fri Jan 12 20:21:47 2007 +0000
@@ -0,0 +1,50 @@
+$NetBSD: patch-af,v 1.1 2007/01/12 20:21:47 wiz Exp $
+
+--- plugins/flac/flacdecode.cpp.orig   2005-06-23 22:38:12.000000000 +0000
++++ plugins/flac/flacdecode.cpp
+@@ -28,6 +28,14 @@
+ #include <string.h>
+ #include "flacdecode.h"
+ 
++#include <FLAC/export.h>
++/* FLAC 1.1.3 has FLAC_API_VERSION_CURRENT == 8 */
++#if !defined(FLAC_API_VERSION_CURRENT) || FLAC_API_VERSION_CURRENT < 8
++#define LEGACY_FLAC
++#else
++#undef LEGACY_FLAC
++#endif
++
+ void FLAC_errorcb(const FLAC__StreamDecoder * decoder,
+                   FLAC__StreamDecoderErrorStatus status, void *client_data)
+ {
+@@ -99,7 +107,11 @@ FLAC__StreamDecoderWriteStatus FLAC_writ
+ 
+ FLAC__StreamDecoderReadStatus FLAC_readcb(const FLAC__StreamDecoder *decoder, 
+                                           FLAC__byte buffer[], 
++#ifdef LEGACY_FLAC
+                                           unsigned *bytes, 
++#else
++                                          size_t *bytes, 
++#endif
+                                           void *client_data)
+ {
+    clientdata_t *cd = reinterpret_cast < clientdata_t * >(client_data);
+@@ -131,6 +143,7 @@ FlacDecode::FlacDecode(const string & fi
+    if (!cd.in)
+       return;
+ 
++#ifdef LEGACY_FLAC
+    if (!FLAC__stream_decoder_set_read_callback(decoder, &FLAC_readcb))
+       return;
+ 
+@@ -149,6 +162,10 @@ FlacDecode::FlacDecode(const string & fi
+    state = FLAC__stream_decoder_init(decoder);
+    if (state != FLAC__STREAM_DECODER_SEARCH_FOR_METADATA)
+       return;
++#else
++   if (FLAC__stream_decoder_init_stream(decoder, &FLAC_readcb, NULL, NULL, NULL, NULL, &FLAC_writecb, &FLAC_metadatacb, &FLAC_errorcb, &cd) != FLAC__STREAM_DECODER_INIT_STATUS_OK)
++      return;
++#endif
+ 
+    FLAC__stream_decoder_process_until_end_of_metadata(decoder);
+    state = FLAC__stream_decoder_get_state(decoder);
diff -r da8056a079dd -r 61a77ed390c1 audio/libtunepimp0.4/patches/patch-ag
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/audio/libtunepimp0.4/patches/patch-ag     Fri Jan 12 20:21:47 2007 +0000
@@ -0,0 +1,16 @@
+$NetBSD: patch-ag,v 1.1 2007/01/12 20:21:47 wiz Exp $
+
+--- plugins/flac/flacdecode.h.orig     2005-06-15 01:08:20.000000000 +0000
++++ plugins/flac/flacdecode.h
+@@ -25,8 +25,8 @@
+ 
+ ----------------------------------------------------------------------------*/
+-#ifndef __VORBIS_DECODE_H
+-#define __VORBIS_DECODE_H
++#ifndef __FLAC_DECODE_H
++#define __FLAC_DECODE_H
+ 
+-#include <FLAC/file_decoder.h>
++#include <FLAC/stream_decoder.h>
+ #include <string>
+ #include "decode_plugin.h"
diff -r da8056a079dd -r 61a77ed390c1 audio/moc/distinfo
--- a/audio/moc/distinfo        Fri Jan 12 20:16:04 2007 +0000
+++ b/audio/moc/distinfo        Fri Jan 12 20:21:47 2007 +0000
@@ -1,5 +1,6 @@
-$NetBSD: distinfo,v 1.4 2006/02/12 18:35:55 xtraeme Exp $
+$NetBSD: distinfo,v 1.5 2007/01/12 20:26:05 wiz Exp $
 
 SHA1 (moc-2.4.0.tar.bz2) = 4741fd9098af8b1c375b5232ba460da2077a5cb8
 RMD160 (moc-2.4.0.tar.bz2) = 084411d527bbeabd7caaae5acf8a3391a2d07f8f
 Size (moc-2.4.0.tar.bz2) = 419792 bytes
+SHA1 (patch-aa) = a797dc880a550e2acdb3b6f0e362b3a27666bc72
diff -r da8056a079dd -r 61a77ed390c1 audio/moc/patches/patch-aa
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/audio/moc/patches/patch-aa        Fri Jan 12 20:21:47 2007 +0000
@@ -0,0 +1,307 @@
+$NetBSD: patch-aa,v 1.4 2007/01/12 20:26:05 wiz Exp $
+
+--- decoder_plugins/flac/flac.c.orig   2006-02-12 11:55:10.000000000 +0000
++++ decoder_plugins/flac/flac.c
+@@ -28,6 +28,13 @@
+ #include "log.h"
+ #include "io.h"
+ 
++/* by LEGACY_FLAC we mean pre-1.1.3, before FLAC__SeekableStreamDecoder was merged into FLAC__StreamDecoder */
++#if !defined(FLAC_API_VERSION_CURRENT) || FLAC_API_VERSION_CURRENT < 8
++#define LEGACY_FLAC
++#else
++#undef LEGACY_FLAC
++#endif
++
+ #define MAX_SUPPORTED_CHANNELS                2
+ 
+ #define SAMPLES_PER_WRITE             512
+@@ -35,7 +42,11 @@
+ 
+ struct flac_data
+ {
++#ifdef LEGACY_FLAC
+       FLAC__SeekableStreamDecoder *decoder;
++#else
++      FLAC__StreamDecoder *decoder;
++#endif
+       struct io_stream *stream;
+       int bitrate;
+       int abort; /* abort playing (due to an error) */
+@@ -109,7 +120,11 @@ static size_t pack_pcm_signed (FLAC__byt
+ }
+ 
+ static FLAC__StreamDecoderWriteStatus write_callback (
++#ifdef LEGACY_FLAC
+               const FLAC__SeekableStreamDecoder *decoder ATTR_UNUSED,
++#else
++              const FLAC__StreamDecoder *decoder ATTR_UNUSED,
++#endif
+               const FLAC__Frame *frame,
+               const FLAC__int32 * const buffer[], void *client_data)
+ {
+@@ -127,7 +142,11 @@ static FLAC__StreamDecoderWriteStatus wr
+ }
+ 
+ static void metadata_callback (
++#ifdef LEGACY_FLAC
+               const FLAC__SeekableStreamDecoder *decoder ATTR_UNUSED,
++#else
++              const FLAC__StreamDecoder *decoder ATTR_UNUSED,
++#endif
+               const FLAC__StreamMetadata *metadata, void *client_data)
+ {
+       struct flac_data *data = (struct flac_data *)client_data;
+@@ -147,7 +166,11 @@ static void metadata_callback (
+ }
+ 
+ static void error_callback (
++#ifdef LEGACY_FLAC
+               const FLAC__SeekableStreamDecoder *decoder ATTR_UNUSED,
++#else
++              const FLAC__StreamDecoder *decoder ATTR_UNUSED,
++#endif
+               FLAC__StreamDecoderErrorStatus status, void *client_data)
+ {
+       struct flac_data *data = (struct flac_data *)client_data;
+@@ -160,9 +183,15 @@ static void error_callback (
+               decoder_error (&data->error, ERROR_FATAL, 0, "FLAC: lost sync");
+ }
+ 
++#ifdef LEGACY_FLAC
+ static FLAC__SeekableStreamDecoderReadStatus read_callback (
+               const FLAC__SeekableStreamDecoder *decoder ATTR_UNUSED,
+               FLAC__byte buffer[], unsigned *bytes, void *client_data)
++#else
++static FLAC__StreamDecoderReadStatus read_callback (
++              const FLAC__StreamDecoder *decoder ATTR_UNUSED,
++              FLAC__byte buffer[], size_t *bytes, void *client_data)
++#endif
+ {
+       struct flac_data *data = (struct flac_data *)client_data;
+       ssize_t res;
+@@ -171,52 +200,97 @@ static FLAC__SeekableStreamDecoderReadSt
+ 
+       if (res > 0) {
+               *bytes = res;
++#ifdef LEGACY_FLAC
++              return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_OK;
++#else
+               return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
++#endif
+       }
+       
+       if (res == 0) {
+               *bytes = 0;
++              /* not sure why this works, but if it ain't broke... */
+               return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM;
+       }
+ 
+       error ("read error: %s", io_strerror(data->stream));
+ 
++#ifdef LEGACY_FLAC
++      return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR;
++#else
+       return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
++#endif
+ }
+ 
++#ifdef LEGACY_FLAC
+ static FLAC__SeekableStreamDecoderSeekStatus seek_callback (
+               const FLAC__SeekableStreamDecoder *decoder ATTR_UNUSED,
+               FLAC__uint64 absolute_byte_offset, void *client_data)
++#else
++static FLAC__StreamDecoderSeekStatus seek_callback (
++              const FLAC__StreamDecoder *decoder ATTR_UNUSED,
++              FLAC__uint64 absolute_byte_offset, void *client_data)
++#endif
+ {
+       struct flac_data *data = (struct flac_data *)client_data;
+       
++#ifdef LEGACY_FLAC
+       return io_seek(data->stream, absolute_byte_offset, SEEK_SET) >= 0
+               ? FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_OK
+               : FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_ERROR;
++#else
++      return io_seek(data->stream, absolute_byte_offset, SEEK_SET) >= 0
++              ? FLAC__STREAM_DECODER_SEEK_STATUS_OK
++              : FLAC__STREAM_DECODER_SEEK_STATUS_ERROR;
++#endif
+ }
+ 
++#ifdef LEGACY_FLAC
+ static FLAC__SeekableStreamDecoderTellStatus tell_callback (
+               const FLAC__SeekableStreamDecoder *decoder ATTR_UNUSED,
+               FLAC__uint64 *absolute_byte_offset, void *client_data)
++#else
++static FLAC__StreamDecoderTellStatus tell_callback (
++              const FLAC__StreamDecoder *decoder ATTR_UNUSED,
++              FLAC__uint64 *absolute_byte_offset, void *client_data)
++#endif
+ {
+       struct flac_data *data = (struct flac_data *)client_data;
+ 
+       *absolute_byte_offset = io_tell (data->stream);
++#ifdef LEGACY_FLAC
+       return FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_OK;
++#else
++      return FLAC__STREAM_DECODER_TELL_STATUS_OK;
++#endif
+ }
+ 
++#ifdef LEGACY_FLAC
+ static FLAC__SeekableStreamDecoderLengthStatus length_callback (
+               const FLAC__SeekableStreamDecoder *decoder ATTR_UNUSED,
+               FLAC__uint64 *stream_length, void *client_data)
++#else
++static FLAC__StreamDecoderLengthStatus length_callback (
++              const FLAC__StreamDecoder *decoder ATTR_UNUSED,
++              FLAC__uint64 *stream_length, void *client_data)
++#endif
+ {
+       struct flac_data *data = (struct flac_data *)client_data;
+ 
+       *stream_length = io_file_size (data->stream);
++#ifdef LEGACY_FLAC
+       return FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_OK;
++#else
++      return FLAC__STREAM_DECODER_LENGTH_STATUS_OK;
++#endif
+ }
+ 
+ static FLAC__bool eof_callback (
++#ifdef LEGACY_FLAC
+               const FLAC__SeekableStreamDecoder *decoder ATTR_UNUSED,
++#else
++              const FLAC__StreamDecoder *decoder ATTR_UNUSED,
++#endif
+               void *client_data)
+ {
+       struct flac_data *data = (struct flac_data *)client_data;
+@@ -248,6 +322,7 @@ static void *flac_open_internal (const c
+ 
+       data->ok = 1;
+ 
++#ifdef LEGACY_FLAC
+       if (!(data->decoder = FLAC__seekable_stream_decoder_new())) {
+               decoder_error (&data->error, ERROR_FATAL, 0,
+                               "FLAC__seekable_stream_decoder_new() failed");
+@@ -279,7 +354,7 @@ static void *flac_open_internal (const c
+                       eof_callback);
+ 
+       if (FLAC__seekable_stream_decoder_init(data->decoder)
+-                      != FLAC__FILE_DECODER_OK) {
++                      != FLAC__SEEKABLE_STREAM_DECODER_OK) {
+               decoder_error (&data->error, ERROR_FATAL, 0,
+                               "FLAC__seekable_stream_decoder_init() failed");



Home | Main Index | Thread Index | Old Index