From 02786a01a3a0817b5b85efd3e9ebcfb0719be5bf Mon Sep 17 00:00:00 2001 From: Bernard Cafarelli Date: Wed, 23 Dec 2009 20:39:19 +0000 Subject: Convert musepack support to SV8 api, thanks to ssuominen in bug #297910 (Portage version: 2.2_rc60/cvs/Linux x86_64) --- gnustep-apps/cynthiune/ChangeLog | 8 +- gnustep-apps/cynthiune/cynthiune-0.9.5-r5.ebuild | 67 +++++ .../files/cynthiune-0.9.5-libmpcdec.patch | 310 +++++++++++++++++++++ 3 files changed, 384 insertions(+), 1 deletion(-) create mode 100644 gnustep-apps/cynthiune/cynthiune-0.9.5-r5.ebuild create mode 100644 gnustep-apps/cynthiune/files/cynthiune-0.9.5-libmpcdec.patch (limited to 'gnustep-apps') diff --git a/gnustep-apps/cynthiune/ChangeLog b/gnustep-apps/cynthiune/ChangeLog index 9c4f29e19fa8..58baecb23fef 100644 --- a/gnustep-apps/cynthiune/ChangeLog +++ b/gnustep-apps/cynthiune/ChangeLog @@ -1,6 +1,12 @@ # ChangeLog for gnustep-apps/cynthiune # Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/gnustep-apps/cynthiune/ChangeLog,v 1.25 2009/11/10 21:51:47 volkmar Exp $ +# $Header: /var/cvsroot/gentoo-x86/gnustep-apps/cynthiune/ChangeLog,v 1.26 2009/12/23 20:39:18 voyageur Exp $ + +*cynthiune-0.9.5-r5 (23 Dec 2009) + + 23 Dec 2009; Bernard Cafarelli + +cynthiune-0.9.5-r5.ebuild, +files/cynthiune-0.9.5-libmpcdec.patch: + Convert musepack support to SV8 api, thanks to ssuominen in bug #297910 10 Nov 2009; Mounir Lamouri cynthiune-0.9.5-r4.ebuild: diff --git a/gnustep-apps/cynthiune/cynthiune-0.9.5-r5.ebuild b/gnustep-apps/cynthiune/cynthiune-0.9.5-r5.ebuild new file mode 100644 index 000000000000..2a685dcd706e --- /dev/null +++ b/gnustep-apps/cynthiune/cynthiune-0.9.5-r5.ebuild @@ -0,0 +1,67 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/gnustep-apps/cynthiune/cynthiune-0.9.5-r5.ebuild,v 1.1 2009/12/23 20:39:18 voyageur Exp $ + +inherit gnustep-2 + +S=${WORKDIR}/${P/c/C} + +DESCRIPTION="Free software and romantic music player for GNUstep." +HOMEPAGE="http://organact.mine.nu/~wolfgang/cynthiune" +SRC_URI="http://organact.mine.nu/~wolfgang/cynthiune/${P/c/C}.tar.gz" + +IUSE="flac mad modplug musepack timidity vorbis" + +KEYWORDS="~amd64 ~ppc ~x86" +LICENSE="GPL-2" +SLOT="0" + +RDEPEND="media-libs/audiofile + media-libs/taglib + flac? ( media-libs/flac ) + mad? ( media-libs/libid3tag + media-libs/libmad ) + musepack? ( >=media-sound/musepack-tools-444 ) + modplug? ( media-libs/libmodplug ) + timidity? ( media-sound/timidity++ ) + vorbis? ( >=media-libs/libogg-1.1.2 + >=media-libs/libvorbis-1.0.1-r2 ) + =media-libs/musicbrainz-2*" +DEPEND="${RDEPEND} + mad? ( dev-util/pkgconfig )" + +src_unpack() { + unpack ${A} + cd "${S}" + + epatch "${FILESDIR}"/${P}-flac-1.1.3.patch + epatch "${FILESDIR}"/${P}-set-macro.patch + epatch "${FILESDIR}"/${P}-NSCellExtensions.patch + epatch "${FILESDIR}"/${P}-NSMutableDictionary.patch + epatch "${FILESDIR}"/${P}-gnustep-make-2.patch + epatch "${FILESDIR}"/${P}-as-needed.patch + epatch "${FILESDIR}"/${P}-libmpcdec.patch +} + +cynthiune_get_config() { + # Gentoo doesn't have libavi (any more) + local myconf="disable-windowsmedia=yes disable-arts=yes disable-esound=yes" + use flac || myconf="${myconf} disable-flac=yes disable-flactags=yes" + use mad || myconf="${myconf} disable-mp3=yes disable-id3tag=yes" + use modplug || myconf="${myconf} disable-mod=yes" + use musepack || myconf="${myconf} disable-musepack=yes" + use timidity || myconf="${myconf} disable-timidity=yes" + use vorbis || myconf="${myconf} disable-ogg=yes disable-vorbistags=yes" + + echo ${myconf} +} + +src_compile() { + egnustep_env + egnustep_make "$(cynthiune_get_config)" || die "make failed" +} + +src_install() { + egnustep_env + egnustep_install "$(cynthiune_get_config)" || die +} diff --git a/gnustep-apps/cynthiune/files/cynthiune-0.9.5-libmpcdec.patch b/gnustep-apps/cynthiune/files/cynthiune-0.9.5-libmpcdec.patch new file mode 100644 index 000000000000..1c89f4b4f86b --- /dev/null +++ b/gnustep-apps/cynthiune/files/cynthiune-0.9.5-libmpcdec.patch @@ -0,0 +1,310 @@ +2009-05-19 Yavor Doganov + + * Bundsles/Musepack/CNSFileHandle.h: Import . + (CNSFileHandleRetain, CNSFileHandleRelease): Remove prototypes. + (CNSFileHandleRead, CNSFileHandleTell, CNSFileHandleCanSeek) + (CNSFileHandleSeek, CNSFileHandleGetSize): Accept mpc_reader + type as first argument. + * Bundles/Musepack/CNSFileHandle.m (CNSFileHandleRetain) + (CNSFileHandleRelease): Delete; unused. + (CNSFileHandleRead, CNSFileHandleTell, CNSFileHandleCanSeek) + (CNSFileHandleSeek, CNSFileHandleGetSize): Adjust for the new + mpc_reader type. + * Bundles/Musepack/Musepack.h : Declare of + mpc_demux type. + * Bundles/Musepack/Musepack.m: Import . + (MPCReaderDelete): Use `mpc_reader_exit_stdio' instead of + `free'. + (MPCStreamInfoNew): Don't call `mpc_streaminfo_init'. + (MPCDecoderNew): Remove function. + ([Musepack -streamOpen]): Initialize the decoder with the new + API function `mpc_demux_init'. + ([Musepack +streamTestOpen]): Likewise. + ([Musepack -readNextChunk:withSize:]): Adjust to use + `mpc_demux_decode'. + : New local variables. + : Remove. + ([Musepack -readDuration]): Use `mpc_streaminfo_get_length' to + obtain the duration and return its result casted to unsigned int. + ([Musepack -streamClose]): Use `mpc_demux_exit' as appropriate. + ([Musepack +acceptedFileExtensions]): Recognize `.mpp'. + ([Musepack -seek]): Use `mpc_demux_seek_second'. + +--- cynthiune.app-0.9.5.orig/Bundles/Musepack/CNSFileHandle.h ++++ cynthiune.app-0.9.5/Bundles/Musepack/CNSFileHandle.h +@@ -23,20 +23,17 @@ + #ifndef CNSFILEHANDLE_H + #define CNSFILEHANDLE_H + +-#include ++#import + + #ifdef __cplusplus + extern "C" { + #endif /* __cplusplus */ + +-void CNSFileHandleRetain (void *fileHandle); +-void CNSFileHandleRelease (void *fileHandle); +- +-int CNSFileHandleRead (void *fileHandle, void *ptr, int size); +-int CNSFileHandleTell (void *fileHandle); +-mpc_bool_t CNSFileHandleCanSeek (void *fileHandle); +-mpc_bool_t CNSFileHandleSeek (void *fileHandle, int offset); +-int CNSFileHandleGetSize (void *fileHandle); ++int CNSFileHandleRead (mpc_reader *fileHandle, void *ptr, int size); ++int CNSFileHandleTell (mpc_reader *fileHandle); ++mpc_bool_t CNSFileHandleCanSeek (mpc_reader *fileHandle); ++mpc_bool_t CNSFileHandleSeek (mpc_reader *fileHandle, int offset); ++int CNSFileHandleGetSize (mpc_reader *fileHandle); + + #ifdef __cplusplus + } +--- cynthiune.app-0.9.5.orig/Bundles/Musepack/CNSFileHandle.m ++++ cynthiune.app-0.9.5/Bundles/Musepack/CNSFileHandle.m +@@ -26,57 +26,45 @@ + + #import "CNSFileHandle.h" + +-void +-CNSFileHandleRetain (void *fileHandle) +-{ +- [(NSFileHandle *) fileHandle retain]; +-} +- +-void +-CNSFileHandleRelease (void *fileHandle) +-{ +- [(NSFileHandle *) fileHandle release]; +-} +- + int +-CNSFileHandleRead (void *fileHandle, void *ptr, int size) ++CNSFileHandleRead (mpc_reader *fileHandle, void *ptr, int size) + { + NSData *data; + +- data = [(NSFileHandle *) fileHandle readDataOfLength: size]; ++ data = [(NSFileHandle *) fileHandle->data readDataOfLength: size]; + [data getBytes: ptr]; + + return [data length]; + } + + int +-CNSFileHandleTell (void *fileHandle) ++CNSFileHandleTell (mpc_reader *fileHandle) + { +- return [(NSFileHandle *) fileHandle offsetInFile]; ++ return [(NSFileHandle *) fileHandle->data offsetInFile]; + } + + mpc_bool_t +-CNSFileHandleCanSeek (void *fileHandle) ++CNSFileHandleCanSeek (mpc_reader *fileHandle) + { + return YES; + } + + mpc_bool_t +-CNSFileHandleSeek (void *fileHandle, int offset) ++CNSFileHandleSeek (mpc_reader *fileHandle, int offset) + { +- [(NSFileHandle *) fileHandle seekToFileOffset: (long long) offset]; ++ [(NSFileHandle *) fileHandle->data seekToFileOffset: (long long) offset]; + + return YES; + } + + int +-CNSFileHandleGetSize (void *fileHandle) ++CNSFileHandleGetSize (mpc_reader *fileHandle) + { + int size, where; + +- where = [(NSFileHandle *) fileHandle offsetInFile]; +- size = [(NSFileHandle *) fileHandle seekToEndOfFile]; +- [(NSFileHandle *) fileHandle seekToFileOffset: (long long) where]; ++ where = [(NSFileHandle *) fileHandle->data offsetInFile]; ++ size = [(NSFileHandle *) fileHandle->data seekToEndOfFile]; ++ [(NSFileHandle *) fileHandle->data seekToFileOffset: (long long) where]; + + return size; + } +--- cynthiune.app-0.9.5.orig/Bundles/Musepack/Musepack.h ++++ cynthiune.app-0.9.5/Bundles/Musepack/Musepack.h +@@ -31,7 +31,7 @@ + + mpc_reader *mpcReader; + mpc_streaminfo *mpcStreamInfo; +- mpc_decoder *mpcDecoder; ++ mpc_demux *mpcDecoder; + + MPC_SAMPLE_FORMAT sampleBuffer[maxSamples]; + unsigned char frameBuffer[maxSamples * 4]; +--- cynthiune.app-0.9.5.orig/Bundles/Musepack/Musepack.m ++++ cynthiune.app-0.9.5/Bundles/Musepack/Musepack.m +@@ -30,7 +30,7 @@ + #import + #import + +-#import ++#import + + #import "Musepack.h" + #import "CNSFileHandle.h" +@@ -75,7 +75,7 @@ + MPCReaderDelete (mpc_reader *reader) + { + [(NSFileHandle *) reader->data release]; +- free (reader); ++ mpc_reader_exit_stdio (reader); + } + + static mpc_streaminfo * +@@ -84,23 +84,10 @@ + mpc_streaminfo *streamInfo; + + streamInfo = malloc (sizeof (mpc_streaminfo)); +- mpc_streaminfo_init (streamInfo); + + return streamInfo; + } + +-static mpc_decoder * +-MPCDecoderNew (mpc_reader *reader, mpc_streaminfo *streamInfo) +-{ +- mpc_decoder *decoder; +- +- decoder = malloc (sizeof (mpc_decoder)); +- mpc_decoder_setup (decoder, reader); +- mpc_decoder_initialize (decoder, streamInfo); +- +- return decoder; +-} +- + static inline void + CopyBuffer (const MPC_SAMPLE_FORMAT *buffer, unsigned char *destBuffer, + unsigned int length) +@@ -173,10 +160,13 @@ + { + [fileHandle retain]; + mpcReader = MPCReaderNew (fileHandle); ++ if (!mpcReader) ++ return MPC_FALSE; + mpcStreamInfo = MPCStreamInfoNew (); +- mpc_streaminfo_read (mpcStreamInfo, mpcReader); +- +- mpcDecoder = MPCDecoderNew (mpcReader, mpcStreamInfo); ++ mpcDecoder = mpc_demux_init (mpcReader); ++ if (!mpcDecoder) ++ return MPC_FALSE; ++ mpc_demux_get_info (mpcDecoder, mpcStreamInfo); + + result = YES; + } +@@ -196,6 +186,7 @@ + NSFileHandle *testFileHandle; + mpc_reader *testReader; + mpc_streaminfo *testStreamInfo; ++ mpc_demux *testDecoder; + BOOL result; + + testFileHandle = [NSFileHandle fileHandleForReadingAtPath: fileName]; +@@ -203,9 +194,14 @@ + { + testReader = MPCReaderNew (testFileHandle); + testStreamInfo = MPCStreamInfoNew (); +- result = !mpc_streaminfo_read (testStreamInfo, testReader); +- free (testStreamInfo); +- MPCReaderDelete (testReader); ++ testDecoder = mpc_demux_init (testReader); ++ if (testDecoder) ++ { ++ result = YES; ++ mpc_demux_exit (testDecoder); ++ } ++ if (testReader) ++ MPCReaderDelete (testReader); + } + else + result = NO; +@@ -222,21 +218,29 @@ + withSize: (unsigned int) bufferSize + { + int bytes, status; +- unsigned int vbrAcc, vbrBits; ++ mpc_frame_info frame; ++ mpc_status err; + unsigned long frames, samples; + + status = 1; ++ frame.buffer = sampleBuffer; + +- if (!remaining) ++ while (!remaining) + { +- samples = mpc_decoder_decode (mpcDecoder, sampleBuffer, +- &vbrAcc, &vbrBits); +- if (!samples) +- status = 0; +- else if (samples == (unsigned long) -1) +- status = -1; ++ err = mpc_demux_decode (mpcDecoder, &frame); ++ if (err != MPC_STATUS_OK) ++ { ++ status = -1; ++ break; ++ } ++ else if (frame.bits == -1) ++ { ++ status = 0; ++ break; ++ } + else + { ++ samples = frame.samples; + frames = samples * mpcStreamInfo->channels; + CopyBuffer (sampleBuffer, frameBuffer, frames); + remaining = frames * 2; +@@ -277,7 +281,7 @@ + + - (unsigned int) readDuration + { +- return mpcStreamInfo->pcm_samples / mpcStreamInfo->sample_freq; ++ return (unsigned int) mpc_streaminfo_get_length (mpcStreamInfo); + } + + - (void) streamClose +@@ -287,12 +291,10 @@ + [fileHandle closeFile]; + [fileHandle release]; + } ++ if (mpcDecoder) ++ mpc_demux_exit (mpcDecoder); + if (mpcReader) + MPCReaderDelete (mpcReader); +- if (mpcStreamInfo) +- free (mpcStreamInfo); +- if (mpcDecoder) +- free (mpcDecoder); + + [self _resetIVars]; + } +@@ -300,7 +302,7 @@ + // Player Protocol + + (NSArray *) acceptedFileExtensions + { +- return [NSArray arrayWithObjects: @"mpc", @"mp+", nil]; ++ return [NSArray arrayWithObjects: @"mpc", @"mp+", @"mpp", nil]; + } + + - (BOOL) isSeekable +@@ -310,7 +312,7 @@ + + - (void) seek: (unsigned int) aPos + { +- mpc_decoder_seek_seconds (mpcDecoder, (double) aPos); ++ mpc_demux_seek_second (mpcDecoder, (double) aPos); + } + + @end -- cgit v1.2.3-65-gdbad