summaryrefslogtreecommitdiff
path: root/vorbis-tools/vorbis-tools.diff
blob: 49cae6d23f852f57612ee1e7999649d26391f3c9 (plain)
    1 Fix compilation with latest curl.
    2 Patch stolen from NetBSD.
    3 
    4 Fix compilation with FLAC 1.1.3+.
    5 Patch stolen from Arch Linux.
    6 
    7 --- vorbis-tools-1.1.1.orig/ogg123/http_transport.c	2005-06-13 13:11:44.000000000 +0000
    8 +++ vorbis-tools-1.1.1/ogg123/http_transport.c
    9 @@ -116,7 +116,6 @@ void set_curl_opts (http_private_t *priv
   10    if (inputOpts.ProxyTunnel)
   11      curl_easy_setopt (handle, CURLOPT_HTTPPROXYTUNNEL, inputOpts.ProxyTunnel);
   12    */
   13 -  curl_easy_setopt(handle, CURLOPT_MUTE, 1);
   14    curl_easy_setopt(handle, CURLOPT_ERRORBUFFER, private->error);
   15    curl_easy_setopt(handle, CURLOPT_PROGRESSFUNCTION, progress_callback);
   16    curl_easy_setopt(handle, CURLOPT_PROGRESSDATA, private);
   17 
   18 --- vorbis-tools-1.1.1.orig/configure.ac	2005-06-27 10:25:51.000000000 +0100
   19 +++ vorbis-tools-1.1.1/configure.ac	2007-04-07 17:26:15.000000000 +0100
   20 @@ -169,17 +169,33 @@
   21  
   22  FLAC_LIBS=""
   23  if test "x$build_flac" = xyes; then
   24 +
   25    AC_CHECK_LIB(m,log,FLAC_LIBS="-lm")
   26 -  AC_CHECK_LIB(FLAC, [FLAC__stream_decoder_process_single],
   27 -    [have_libFLAC=yes; FLAC_LIBS="-lFLAC $FLAC_LIBS"],
   28 -    AC_MSG_WARN([libFLAC missing])
   29 -    have_libFLAC=no, [$FLAC_LIBS]
   30 -  )
   31 -  AC_CHECK_LIB(OggFLAC, [OggFLAC__stream_decoder_new],
   32 -    [FLAC_LIBS="-lOggFLAC $FLAC_LIBS $OGG_LIBS"],
   33 -    AC_MSG_WARN([libOggFLAC missing])
   34 -    have_libFLAC=no, [$FLAC_LIBS $OGG_LIBS]
   35 -  )
   36 +
   37 +  dnl First check for libFLAC-1.1.3 or later. As of libFLAC 1.1.3,
   38 +  dnl OggFLAC functionality has been rolled into libFLAC rather
   39 +  dnl than being in a separate libOggFLAC library.
   40 +
   41 +  AC_CHECK_LIB(FLAC, [FLAC__stream_decoder_init_ogg_stream],
   42 +    have_libFLAC=yes, have_libFLAC=no, [$FLAC_LIBS $OGG_LIBS])
   43 +
   44 +  if test "x$have_libFLAC" = xyes; then
   45 +    FLAC_LIBS="-lFLAC $FLAC_LIBS $OGG_LIBS"
   46 +  else
   47 +    dnl Check for libFLAC prior to 1.1.3
   48 +    AC_CHECK_LIB(FLAC, [FLAC__stream_decoder_process_single],
   49 +      [have_libFLAC=yes; FLAC_LIBS="-lFLAC $FLAC_LIBS"],
   50 +      AC_MSG_WARN([libFLAC missing])
   51 +      have_libFLAC=no, [$FLAC_LIBS]
   52 +    )
   53 +
   54 +    AC_CHECK_LIB(OggFLAC, [OggFLAC__stream_decoder_new],
   55 +      [FLAC_LIBS="-lOggFLAC $FLAC_LIBS $OGG_LIBS"],
   56 +      AC_MSG_WARN([libOggFLAC missing])
   57 +      have_libFLAC=no, [$FLAC_LIBS $OGG_LIBS]
   58 +    )
   59 +  fi
   60 +
   61    AC_CHECK_HEADER(FLAC/stream_decoder.h,,
   62      AC_MSG_WARN(libFLAC headers missing)
   63      have_libFLAC=no,[ ])
   64 --- vorbis-tools-1.1.1.orig/ogg123/flac_format.c	2005-06-03 11:15:09.000000000 +0100
   65 +++ vorbis-tools-1.1.1/ogg123/flac_format.c	2007-04-07 17:25:14.000000000 +0100
   66 @@ -20,18 +20,26 @@
   67  #include <string.h>
   68  #include <sys/types.h>
   69  #include <math.h>
   70 -#include <FLAC/metadata.h>
   71 +#include <FLAC/all.h>
   72  #include <ao/ao.h>
   73  #include "audio.h"
   74  #include "format.h"
   75  #include "i18n.h"
   76 +#if !defined(FLAC_API_VERSION_CURRENT) || (FLAC_API_VERSION_CURRENT < 8)
   77 +#define NEED_EASYFLAC 1
   78 +#endif
   79 +#if NEED_EASYFLAC
   80  #include "easyflac.h"
   81 +#endif
   82  #include "vorbis_comments.h"
   83  
   84 -#define DEFAULT_FLAC_FRAME_SIZE 4608
   85 -
   86  typedef struct {
   87 +#if NEED_EASYFLAC
   88    EasyFLAC__StreamDecoder *decoder;
   89 +#else
   90 +  FLAC__StreamDecoder *decoder;
   91 +  int is_oggflac;
   92 +#endif
   93    short channels;
   94    int rate;
   95    int bits_per_sample;
   96 @@ -67,10 +75,18 @@
   97  
   98  
   99  /* Private functions declarations */
  100 -FLAC__StreamDecoderReadStatus easyflac_read_callback(const EasyFLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data);
  101 -FLAC__StreamDecoderWriteStatus easyflac_write_callback(const EasyFLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data);
  102 -void easyflac_metadata_callback(const EasyFLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data);
  103 -void easyflac_error_callback(const EasyFLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data);
  104 +#if NEED_EASYFLAC
  105 +static FLAC__StreamDecoderReadStatus easyflac_read_callback(const EasyFLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data);
  106 +static FLAC__StreamDecoderWriteStatus easyflac_write_callback(const EasyFLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data);
  107 +static void easyflac_metadata_callback(const EasyFLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data);
  108 +static void easyflac_error_callback(const EasyFLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data);
  109 +#else
  110 +static FLAC__StreamDecoderReadStatus read_callback(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data);
  111 +static FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data);
  112 +static void metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data);
  113 +static void error_callback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data);
  114 +static FLAC__bool eof_callback(const FLAC__StreamDecoder *decoder, void *client_data);
  115 +#endif
  116  
  117  void resize_buffer(flac_private_t *flac, int newchannels, int newsamples);
  118  /*void copy_comments (vorbis_comment *v_comments, FLAC__StreamMetadata_VorbisComment *f_comments);*/
  119 @@ -155,6 +171,7 @@
  120    private->buf_start = 0;
  121    
  122    /* Setup FLAC decoder */
  123 +#if NEED_EASYFLAC
  124    if (oggflac_can_decode(source)) {
  125      decoder->format = &oggflac_format;
  126      private->decoder = EasyFLAC__stream_decoder_new(1);
  127 @@ -172,13 +189,40 @@
  128    EasyFLAC__set_metadata_respond(private->decoder, FLAC__METADATA_TYPE_STREAMINFO);
  129    EasyFLAC__set_metadata_respond(private->decoder, FLAC__METADATA_TYPE_VORBIS_COMMENT);
  130    EasyFLAC__init(private->decoder);
  131 +#else
  132 +  if (oggflac_can_decode(source)) {
  133 +    private->is_oggflac = 1;
  134 +    decoder->format = &oggflac_format;
  135 +  } else {
  136 +    private->is_oggflac = 0;
  137 +    decoder->format = &flac_format;
  138 +  }
  139 +  private->decoder = FLAC__stream_decoder_new();
  140 +
  141 +  FLAC__stream_decoder_set_md5_checking(private->decoder, false);
  142 +  FLAC__stream_decoder_set_metadata_respond(private->decoder, FLAC__METADATA_TYPE_STREAMINFO);
  143 +  FLAC__stream_decoder_set_metadata_respond(private->decoder, FLAC__METADATA_TYPE_VORBIS_COMMENT);
  144 +  /*FLAC__stream_decoder_init(private->decoder);*/
  145 +  if(private->is_oggflac)
  146 +    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);
  147 +  else
  148 +    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);
  149 +#endif
  150    
  151    /* Callback will set the total samples and sample rate */
  152 +#if NEED_EASYFLAC
  153    EasyFLAC__process_until_end_of_metadata(private->decoder);
  154 +#else
  155 +  FLAC__stream_decoder_process_until_end_of_metadata(private->decoder);
  156 +#endif
  157  
  158    /* Callback will set the number of channels and resize the 
  159       audio buffer */
  160 +#if NEED_EASYFLAC
  161    EasyFLAC__process_single(private->decoder);
  162 +#else
  163 +  FLAC__stream_decoder_process_single(private->decoder);
  164 +#endif
  165  
  166    /* FLAC API returns signed samples on all streams */
  167    decoder->actual_fmt.signed_sample = 1;
  168 @@ -241,11 +285,19 @@
  169        realsamples += copy;
  170      }
  171      else if (!priv->eos) {
  172 +#if NEED_EASYFLAC
  173        ret = EasyFLAC__process_single(priv->decoder);
  174        if (!ret ||
  175  	  EasyFLAC__get_state(priv->decoder)
  176  	  == FLAC__STREAM_DECODER_END_OF_STREAM)
  177  	priv->eos = 1;  /* Bail out! */
  178 +#else
  179 +      ret = FLAC__stream_decoder_process_single(priv->decoder);
  180 +      if (!ret ||
  181 +	  FLAC__stream_decoder_get_state(priv->decoder)
  182 +	  == FLAC__STREAM_DECODER_END_OF_STREAM)
  183 +	priv->eos = 1;  /* Bail out! */
  184 +#endif
  185      } else
  186        break;
  187    }
  188 @@ -311,8 +363,13 @@
  189      free(priv->buf[i]);
  190    
  191    free(priv->buf);
  192 +#if NEED_EASYFLAC
  193    EasyFLAC__finish(priv->decoder);
  194    EasyFLAC__stream_decoder_delete(priv->decoder);
  195 +#else
  196 +  FLAC__stream_decoder_finish(priv->decoder);
  197 +  FLAC__stream_decoder_delete(priv->decoder);
  198 +#endif
  199  
  200    free(decoder->private);
  201    free(decoder);
  202 @@ -342,7 +399,11 @@
  203  
  204  
  205  
  206 +#if NEED_EASYFLAC
  207  FLAC__StreamDecoderReadStatus easyflac_read_callback(const EasyFLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data)
  208 +#else
  209 +FLAC__StreamDecoderReadStatus read_callback(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data)
  210 +#endif
  211  {
  212    decoder_t *e_decoder = client_data;
  213    flac_private_t *priv = e_decoder->private;
  214 @@ -363,7 +424,11 @@
  215  }
  216  
  217  
  218 +#if NEED_EASYFLAC
  219  FLAC__StreamDecoderWriteStatus easyflac_write_callback(const EasyFLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data)
  220 +#else
  221 +FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data)
  222 +#endif
  223  {
  224    decoder_t *e_decoder = client_data;
  225    flac_private_t *priv = e_decoder->private;
  226 @@ -389,7 +454,11 @@
  227  }
  228  
  229  
  230 +#if NEED_EASYFLAC
  231  void easyflac_metadata_callback(const EasyFLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data)
  232 +#else
  233 +void metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data)
  234 +#endif
  235  {
  236    decoder_t *e_decoder = client_data;
  237    flac_private_t *priv = e_decoder->private;
  238 @@ -409,12 +478,26 @@
  239  }
  240  
  241  
  242 +#if NEED_EASYFLAC
  243  void easyflac_error_callback(const EasyFLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data)
  244 +#else
  245 +void error_callback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data)
  246 +#endif
  247  {
  248  
  249  
  250  }
  251  
  252 +#if !NEED_EASYFLAC
  253 +FLAC__bool eof_callback(const FLAC__StreamDecoder *decoder, void *client_data)
  254 +{
  255 +  decoder_t *e_decoder = client_data;
  256 +  flac_private_t *priv = e_decoder->private;
  257 +
  258 +  return priv->eos;
  259 +}
  260 +#endif
  261 +
  262  
  263  void resize_buffer(flac_private_t *flac, int newchannels, int newsamples)
  264  {
  265 @@ -457,7 +540,11 @@
  266      
  267  
  268    
  269 +#if NEED_EASYFLAC
  270    if (EasyFLAC__is_oggflac(priv->decoder))
  271 +#else
  272 +  if (priv->is_oggflac)
  273 +#endif
  274      cb->printf_metadata(decoder->callback_arg, 2,
  275  			_("Ogg FLAC stream: %d bits, %d channel, %ld Hz"),
  276  			priv->bits_per_sample,
  277 --- vorbis-tools-1.1.1.orig/ogg123/easyflac.c	2005-06-03 11:15:09.000000000 +0100
  278 +++ vorbis-tools-1.1.1/ogg123/easyflac.c	2007-04-07 17:25:26.000000000 +0100
  279 @@ -33,10 +33,12 @@
  280   *
  281   */
  282  
  283 +#include <FLAC/export.h>
  284 +#if !defined(FLAC_API_VERSION_CURRENT) || (FLAC_API_VERSION_CURRENT < 8)
  285 +
  286  #include <stdlib.h>
  287  #include "easyflac.h"
  288  
  289 -
  290  FLAC__bool EasyFLAC__is_oggflac(EasyFLAC__StreamDecoder *decoder)
  291  {
  292  	return decoder->is_oggflac;
  293 @@ -373,3 +375,5 @@
  294  	else
  295  		return FLAC__stream_decoder_process_until_end_of_stream(decoder->flac);
  296  }
  297 +
  298 +#endif
  299 --- vorbis-tools-1.1.1.orig/oggenc/flac.c	2005-06-03 11:15:10.000000000 +0100
  300 +++ vorbis-tools-1.1.1/oggenc/flac.c	2007-04-07 18:17:27.000000000 +0100
  301 @@ -20,15 +20,25 @@
  302  #include "platform.h"
  303  #include "resample.h"
  304  
  305 -#define DEFAULT_FLAC_FRAME_SIZE 4608
  306 +#if !defined(FLAC_API_VERSION_CURRENT) || (FLAC_API_VERSION_CURRENT < 8)
  307 +#define NEED_EASYFLAC 1
  308 +#endif
  309 +
  310 +#if NEED_EASYFLAC
  311 +static FLAC__StreamDecoderReadStatus easyflac_read_callback(const EasyFLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data);
  312 +static FLAC__StreamDecoderWriteStatus easyflac_write_callback(const EasyFLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data);
  313 +static void easyflac_metadata_callback(const EasyFLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data);
  314 +static void easyflac_error_callback(const EasyFLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data);
  315 +#else
  316 +static FLAC__StreamDecoderReadStatus read_callback(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data);
  317 +static FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data);
  318 +static void metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data);
  319 +static void error_callback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data);
  320 +static FLAC__bool eof_callback(const FLAC__StreamDecoder *decoder, void *client_data);
  321 +#endif
  322  
  323 -FLAC__StreamDecoderReadStatus easyflac_read_callback(const EasyFLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data);
  324 -FLAC__StreamDecoderWriteStatus easyflac_write_callback(const EasyFLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data);
  325 -void easyflac_metadata_callback(const EasyFLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data);
  326 -void easyflac_error_callback(const EasyFLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data);
  327 -
  328 -void resize_buffer(flacfile *flac, int newchannels, int newsamples);
  329 -void copy_comments (vorbis_comment *v_comments, FLAC__StreamMetadata_VorbisComment *f_comments);
  330 +static void resize_buffer(flacfile *flac, int newchannels, int newsamples);
  331 +static void copy_comments (vorbis_comment *v_comments, FLAC__StreamMetadata_VorbisComment *f_comments);
  332  
  333  
  334  int flac_id(unsigned char *buf, int len)
  335 @@ -76,6 +86,7 @@
  336  	flac->in = in;
  337  
  338  	/* Setup FLAC decoder */
  339 +#if NEED_EASYFLAC
  340  	flac->decoder = EasyFLAC__stream_decoder_new(oggflac_id(oldbuf, buflen));
  341  	EasyFLAC__set_client_data(flac->decoder, flac);
  342  	EasyFLAC__set_read_callback(flac->decoder, &easyflac_read_callback);
  343 @@ -85,14 +96,32 @@
  344  	EasyFLAC__set_metadata_respond(flac->decoder, FLAC__METADATA_TYPE_STREAMINFO);
  345  	EasyFLAC__set_metadata_respond(flac->decoder, FLAC__METADATA_TYPE_VORBIS_COMMENT);
  346  	EasyFLAC__init(flac->decoder);
  347 +#else
  348 +    flac->decoder = FLAC__stream_decoder_new();
  349 +    FLAC__stream_decoder_set_md5_checking(flac->decoder, false);
  350 +    FLAC__stream_decoder_set_metadata_respond(flac->decoder, FLAC__METADATA_TYPE_STREAMINFO);
  351 +    FLAC__stream_decoder_set_metadata_respond(flac->decoder, FLAC__METADATA_TYPE_VORBIS_COMMENT);
  352 +    if(oggflac_id(oldbuf, buflen))
  353 +        FLAC__stream_decoder_init_ogg_stream(flac->decoder, read_callback, /*seek_callback=*/0, /*tell_callback=*/0, /*length_callback=*/0, eof_callback, write_callback, metadata_callback, error_callback, flac);
  354 +    else
  355 +        FLAC__stream_decoder_init_stream(flac->decoder, read_callback, /*seek_callback=*/0, /*tell_callback=*/0, /*length_callback=*/0, eof_callback, write_callback, metadata_callback, error_callback, flac);
  356 +#endif
  357  	
  358  	/* Callback will set the total samples and sample rate */
  359 +#if NEED_EASYFLAC
  360  	EasyFLAC__process_until_end_of_metadata(flac->decoder);
  361 +#else
  362 +    FLAC__stream_decoder_process_until_end_of_metadata(flac->decoder);
  363 +#endif
  364  
  365  	/* Callback will set the number of channels and resize the 
  366  	   audio buffer */
  367 +#if NEED_EASYFLAC
  368  	EasyFLAC__process_single(flac->decoder);
  369 -	
  370 +#else
  371 +    FLAC__stream_decoder_process_single(flac->decoder);
  372 +#endif
  373 +
  374  	/* Copy format info for caller */
  375  	opt->rate = flac->rate;
  376  	opt->channels = flac->channels;
  377 @@ -133,11 +162,19 @@
  378  		}
  379  		else if (!flac->eos)
  380  		{
  381 +#if NEED_EASYFLAC
  382  			ret = EasyFLAC__process_single(flac->decoder);
  383  			if (!ret ||
  384  			    EasyFLAC__get_state(flac->decoder)
  385  			    == FLAC__STREAM_DECODER_END_OF_STREAM)
  386  				flac->eos = 1;  /* Bail out! */
  387 +#else
  388 +            ret = FLAC__stream_decoder_process_single(flac->decoder);
  389 +            if (!ret ||
  390 +                FLAC__stream_decoder_get_state(flac->decoder)
  391 +                == FLAC__STREAM_DECODER_END_OF_STREAM)
  392 +                flac->eos = 1;  /* Bail out! */
  393 +#endif
  394  		} else
  395  			break;
  396  	}
  397 @@ -157,13 +194,22 @@
  398  	free(flac->buf);
  399  	free(flac->oldbuf);
  400  	free(flac->comments);
  401 +#if NEED_EASYFLAC
  402  	EasyFLAC__finish(flac->decoder);
  403  	EasyFLAC__stream_decoder_delete(flac->decoder);
  404 +#else
  405 +    FLAC__stream_decoder_finish(flac->decoder);
  406 +    FLAC__stream_decoder_delete(flac->decoder);
  407 +#endif
  408  	free(flac);
  409  }
  410  
  411  
  412 +#if NEED_EASYFLAC
  413  FLAC__StreamDecoderReadStatus easyflac_read_callback(const EasyFLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data)
  414 +#else
  415 +FLAC__StreamDecoderReadStatus read_callback(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data)
  416 +#endif
  417  {
  418  	flacfile *flac = (flacfile *) client_data;
  419  	int i = 0;
  420 @@ -200,7 +246,11 @@
  421  	return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;	 
  422  }
  423  
  424 +#if NEED_EASYFLAC
  425  FLAC__StreamDecoderWriteStatus easyflac_write_callback(const EasyFLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data)
  426 +#else
  427 +FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data)
  428 +#endif
  429  {
  430  	flacfile *flac = (flacfile *) client_data;
  431  	int samples = frame->header.blocksize;
  432 @@ -221,7 +271,11 @@
  433  	return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
  434  }
  435  
  436 +#if NEED_EASYFLAC
  437  void easyflac_metadata_callback(const EasyFLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data)
  438 +#else
  439 +void metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data)
  440 +#endif
  441  {
  442  	flacfile *flac = (flacfile *) client_data;
  443  
  444 @@ -240,11 +294,24 @@
  445  	}
  446  }
  447  
  448 +#if NEED_EASYFLAC
  449  void easyflac_error_callback(const EasyFLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data)
  450 +#else
  451 +void error_callback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data)
  452 +#endif
  453  {
  454 -	flacfile *flac = (flacfile *) client_data;
  455 +    flacfile *flac = (flacfile *) client_data;
  456 +
  457 +}
  458 +
  459 +#if !NEED_EASYFLAC
  460 +FLAC__bool eof_callback(const FLAC__StreamDecoder *decoder, void *client_data)
  461 +{
  462 +    flacfile *flac = (flacfile *) client_data;
  463  
  464 +    return feof(flac->in)? true : false;
  465  }
  466 +#endif
  467  
  468  
  469  void resize_buffer(flacfile *flac, int newchannels, int newsamples)
  470 --- vorbis-tools-1.1.1.orig/oggenc/easyflac.c	2005-06-03 11:15:10.000000000 +0100
  471 +++ vorbis-tools-1.1.1/oggenc/easyflac.c	2007-04-07 17:25:56.000000000 +0100
  472 @@ -33,6 +33,9 @@
  473   *
  474   */
  475  
  476 +#include <FLAC/export.h>
  477 +#if !defined(FLAC_API_VERSION_CURRENT) || (FLAC_API_VERSION_CURRENT < 8)
  478 +
  479  #include <stdlib.h>
  480  #include "easyflac.h"
  481  
  482 @@ -373,3 +376,5 @@
  483  	else
  484  		return FLAC__stream_decoder_process_until_end_of_stream(decoder->flac);
  485  }
  486 +
  487 +#endif
  488 --- vorbis-tools-1.1.1.orig/oggenc/flac.h	2005-06-03 11:15:10.000000000 +0100
  489 +++ vorbis-tools-1.1.1/oggenc/flac.h	2007-04-07 17:31:53.000000000 +0100
  490 @@ -5,10 +5,21 @@
  491  #include "encode.h"
  492  #include "audio.h"
  493  #include <stdio.h>
  494 +#include <FLAC/stream_decoder.h>
  495 +#if !defined(FLAC_API_VERSION_CURRENT) || (FLAC_API_VERSION_CURRENT < 8)
  496 +#define NEED_EASYFLAC 1
  497 +#endif
  498 +#if NEED_EASYFLAC
  499 +#include <OggFLAC/stream_decoder.h>
  500  #include "easyflac.h"
  501 +#endif
  502  
  503  typedef struct {
  504 +#if NEED_EASYFLAC
  505  	EasyFLAC__StreamDecoder *decoder;
  506 +#else
  507 +	FLAC__StreamDecoder *decoder;
  508 +#endif
  509  	short channels;
  510  	int rate;
  511  	long totalsamples; /* per channel, of course */

Generated by cgit