head 1.2; access; symbols pkgsrc-2013Q2:1.2.0.20 pkgsrc-2013Q2-base:1.2 pkgsrc-2012Q4:1.2.0.18 pkgsrc-2012Q4-base:1.2 pkgsrc-2011Q4:1.2.0.16 pkgsrc-2011Q4-base:1.2 pkgsrc-2011Q2:1.2.0.14 pkgsrc-2011Q2-base:1.2 pkgsrc-2009Q4:1.2.0.12 pkgsrc-2009Q4-base:1.2 pkgsrc-2008Q4:1.2.0.10 pkgsrc-2008Q4-base:1.2 pkgsrc-2008Q3:1.2.0.8 pkgsrc-2008Q3-base:1.2 cube-native-xorg:1.2.0.6 cube-native-xorg-base:1.2 pkgsrc-2008Q2:1.2.0.4 pkgsrc-2008Q2-base:1.2 pkgsrc-2008Q1:1.2.0.2 pkgsrc-2008Q1-base:1.2 pkgsrc-2007Q4:1.1.0.8 pkgsrc-2007Q4-base:1.1 pkgsrc-2007Q3:1.1.0.6 pkgsrc-2007Q3-base:1.1 pkgsrc-2007Q2:1.1.0.4 pkgsrc-2007Q2-base:1.1 pkgsrc-2007Q1:1.1.0.2 pkgsrc-2007Q1-base:1.1; locks; strict; comment @# @; 1.2 date 2008.03.14.18.55.54; author wiz; state dead; branches; next 1.1; 1.1 date 2007.01.13.15.35.52; author wiz; state Exp; branches; next ; desc @@ 1.2 log @Update to 1.2.0: vorbis-tools 1.2.0 -- 2008-02-21 * FLAC support now relies on libFLAC * Support for large files * Fixed acinclude.m4 to properly support --no switches * ogg123: added remote control support * ogg123: fixed a bug in esd when pressing CTRL + C * ogg123: fixed a type mismatch in option parsing for 64 bit systems * ogg123: configuration no longer hardcoded to /etc * oggdec: limited support for chained Ogg bitstreams * ogg123: compiles with older versions of libcurl * oggdec: support decoding of multiple files into a single one * oggenc: -k, switch for Skeleton bitstream encoding * oggenc: fixed issues with Skeleton on big endian systems * oggenc: proper 5.1 channel mapping support * oggenc: FLAC module does not confuse every Ogg file as its own * oggenc: compiles with older versions of libvorbis * ogginfo: recognizes Skeleton, Dirac, FLAC and Kate bitstreams * vcut: solved issues described in ticket #1313 * vorbiscomment: support for creation of long comments * vorbiscomment: support for multiplexed Vorbis * Several minor bug fixes @ text @$NetBSD: patch-ai,v 1.1 2007/01/13 15:35:52 wiz Exp $ --- ogg123/flac_format.c.orig 2005-06-03 10:15:09.000000000 +0000 +++ ogg123/flac_format.c @@@@ -25,13 +25,23 @@@@ #include "audio.h" #include "format.h" #include "i18n.h" +#if !defined(FLAC_API_VERSION_CURRENT) || (FLAC_API_VERSION_CURRENT < 8) +#define NEED_EASYFLAC 1 +#endif +#if NEED_EASYFLAC #include "easyflac.h" +#else +#include +#endif #include "vorbis_comments.h" -#define DEFAULT_FLAC_FRAME_SIZE 4608 - typedef struct { +#if NEED_EASYFLAC EasyFLAC__StreamDecoder *decoder; +#else + FLAC__StreamDecoder *decoder; + int is_oggflac; +#endif short channels; int rate; int bits_per_sample; @@@@ -67,10 +77,18 @@@@ format_t oggflac_format; /* Private functions declarations */ -FLAC__StreamDecoderReadStatus easyflac_read_callback(const EasyFLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data); -FLAC__StreamDecoderWriteStatus easyflac_write_callback(const EasyFLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data); -void easyflac_metadata_callback(const EasyFLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data); -void easyflac_error_callback(const EasyFLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data); +#if NEED_EASYFLAC +static FLAC__StreamDecoderReadStatus easyflac_read_callback(const EasyFLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data); +static FLAC__StreamDecoderWriteStatus easyflac_write_callback(const EasyFLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data); +static void easyflac_metadata_callback(const EasyFLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data); +static void easyflac_error_callback(const EasyFLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data); +#else +static FLAC__StreamDecoderReadStatus read_callback(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data); +static FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data); +static void metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data); +static void error_callback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data); +static FLAC__bool eof_callback(const FLAC__StreamDecoder *decoder, void *client_data); +#endif void resize_buffer(flac_private_t *flac, int newchannels, int newsamples); /*void copy_comments (vorbis_comment *v_comments, FLAC__StreamMetadata_VorbisComment *f_comments);*/ @@@@ -155,6 +173,7 @@@@ decoder_t* flac_init (data_source_t *sou private->buf_start = 0; /* Setup FLAC decoder */ +#if NEED_EASYFLAC if (oggflac_can_decode(source)) { decoder->format = &oggflac_format; private->decoder = EasyFLAC__stream_decoder_new(1); @@@@ -172,13 +191,39 @@@@ decoder_t* flac_init (data_source_t *sou EasyFLAC__set_metadata_respond(private->decoder, FLAC__METADATA_TYPE_STREAMINFO); EasyFLAC__set_metadata_respond(private->decoder, FLAC__METADATA_TYPE_VORBIS_COMMENT); EasyFLAC__init(private->decoder); +#else + if (oggflac_can_decode(source)) { + private->is_oggflac = 1; + decoder->format = &oggflac_format; + } else { + private->is_oggflac = 0; + decoder->format = &flac_format; + } + private->decoder = FLAC__stream_decoder_new(); + + FLAC__stream_decoder_set_md5_checking(private->decoder, false); + FLAC__stream_decoder_set_metadata_respond(private->decoder, FLAC__METADATA_TYPE_STREAMINFO); + FLAC__stream_decoder_set_metadata_respond(private->decoder, FLAC__METADATA_TYPE_VORBIS_COMMENT); + if(private->is_oggflac) + FLAC__stream_decoder_init_ogg_stream(private->decoder, read_callback, /*seek_callback=*/0, /*tell_callback=*/0, /*length_callback=*/0, eof_callback, write_callback, metadata_callback, error_callback, decoder); + else + FLAC__stream_decoder_init_stream(private->decoder, read_callback, /*seek_callback=*/0, /*tell_callback=*/0, /*length_callback=*/0, eof_callback, write_callback, metadata_callback, error_callback, decoder); +#endif /* Callback will set the total samples and sample rate */ +#if NEED_EASYFLAC EasyFLAC__process_until_end_of_metadata(private->decoder); +#else + FLAC__stream_decoder_process_until_end_of_metadata(private->decoder); +#endif /* Callback will set the number of channels and resize the audio buffer */ +#if NEED_EASYFLAC EasyFLAC__process_single(private->decoder); +#else + FLAC__stream_decoder_process_single(private->decoder); +#endif /* FLAC API returns signed samples on all streams */ decoder->actual_fmt.signed_sample = 1; @@@@ -241,11 +286,19 @@@@ int flac_read (decoder_t *decoder, void realsamples += copy; } else if (!priv->eos) { +#if NEED_EASYFLAC ret = EasyFLAC__process_single(priv->decoder); if (!ret || EasyFLAC__get_state(priv->decoder) == FLAC__STREAM_DECODER_END_OF_STREAM) priv->eos = 1; /* Bail out! */ +#else + ret = FLAC__stream_decoder_process_single(priv->decoder); + if (!ret || + FLAC__stream_decoder_get_state(priv->decoder) + == FLAC__STREAM_DECODER_END_OF_STREAM) + priv->eos = 1; /* Bail out! */ +#endif } else break; } @@@@ -311,8 +364,13 @@@@ void flac_cleanup (decoder_t *decoder) free(priv->buf[i]); free(priv->buf); +#if NEED_EASYFLAC EasyFLAC__finish(priv->decoder); EasyFLAC__stream_decoder_delete(priv->decoder); +#else + FLAC__stream_decoder_finish(priv->decoder); + FLAC__stream_decoder_delete(priv->decoder); +#endif free(decoder->private); free(decoder); @@@@ -342,7 +400,11 @@@@ format_t oggflac_format = { +#if NEED_EASYFLAC FLAC__StreamDecoderReadStatus easyflac_read_callback(const EasyFLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data) +#else +FLAC__StreamDecoderReadStatus read_callback(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data) +#endif { decoder_t *e_decoder = client_data; flac_private_t *priv = e_decoder->private; @@@@ -363,7 +425,11 @@@@ FLAC__StreamDecoderReadStatus easyflac_r } +#if NEED_EASYFLAC FLAC__StreamDecoderWriteStatus easyflac_write_callback(const EasyFLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data) +#else +FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data) +#endif { decoder_t *e_decoder = client_data; flac_private_t *priv = e_decoder->private; @@@@ -389,7 +455,11 @@@@ FLAC__StreamDecoderWriteStatus easyflac_ } +#if NEED_EASYFLAC void easyflac_metadata_callback(const EasyFLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) +#else +void metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) +#endif { decoder_t *e_decoder = client_data; flac_private_t *priv = e_decoder->private; @@@@ -409,12 +479,24 @@@@ void easyflac_metadata_callback(const Ea } +#if NEED_EASYFLAC void easyflac_error_callback(const EasyFLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) +#else +void error_callback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) +#endif { } +#if !NEED_EASYFLAC +FLAC__bool eof_callback(const FLAC__StreamDecoder *decoder, void *client_data) +{ + // can't get this info from the data source, so we'll let the read callback handle it + return false; +} +#endif + void resize_buffer(flac_private_t *flac, int newchannels, int newsamples) { @@@@ -457,7 +539,11 @@@@ void print_flac_stream_info (decoder_t * +#if NEED_EASYFLAC if (EasyFLAC__is_oggflac(priv->decoder)) +#else + if (priv->is_oggflac) +#endif cb->printf_metadata(decoder->callback_arg, 2, _("Ogg FLAC stream: %d bits, %d channel, %ld Hz"), priv->bits_per_sample, @ 1.1 log @Add support for flac-1.1.3 based on Josh Coalson's patches. Bump PKGREVISION because previously it would just disable flac support. @ text @d1 1 a1 1 $NetBSD$ @