Index: src/libFLAC/include/private/macros.h |
diff --git a/src/libFLAC/include/protected/stream_decoder.h b/src/libFLAC/include/private/macros.h |
similarity index 61% |
copy from src/libFLAC/include/protected/stream_decoder.h |
copy to src/libFLAC/include/private/macros.h |
index 9108ca78f225c062965a599f661d8b0199cc9e9f..0eed2d3381bad47d3a4f7c6c5068f60d77553106 100644 |
--- a/src/libFLAC/include/protected/stream_decoder.h |
+++ b/src/libFLAC/include/private/macros.h |
@@ -1,5 +1,5 @@ |
/* libFLAC - Free Lossless Audio Codec library |
- * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson |
+ * Copyright (C) 2012-2014 Xiph.org Foundation |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
@@ -29,30 +29,44 @@ |
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
-#ifndef FLAC__PROTECTED__STREAM_DECODER_H |
-#define FLAC__PROTECTED__STREAM_DECODER_H |
+#ifndef FLAC__PRIVATE__MACROS_H |
+#define FLAC__PRIVATE__MACROS_H |
-#include "FLAC/stream_decoder.h" |
-#if FLAC__HAS_OGG |
-#include "private/ogg_decoder_aspect.h" |
+#if defined(__GNUC__) |
+ |
+#define flac_max(a,b) \ |
+ ({ __typeof__ (a) _a = (a); \ |
+ __typeof__ (b) _b = (b); \ |
+ _a > _b ? _a : _b; }) |
+ |
+#define MIN_PASTE(A,B) A##B |
+#define MIN_IMPL(A,B,L) ({ \ |
+ __typeof__(A) MIN_PASTE(__a,L) = (A); \ |
+ __typeof__(B) MIN_PASTE(__b,L) = (B); \ |
+ MIN_PASTE(__a,L) < MIN_PASTE(__b,L) ? MIN_PASTE(__a,L) : MIN_PASTE(__b,L); \ |
+ }) |
+ |
+#define flac_min(A,B) MIN_IMPL(A,B,__COUNTER__) |
+ |
+/* Whatever other unix that has sys/param.h */ |
+#elif defined(HAVE_SYS_PARAM_H) |
+#include <sys/param.h> |
+#define flac_max(a,b) MAX(a,b) |
+#define flac_min(a,b) MIN(a,b) |
+ |
+/* Windows VS has them in stdlib.h.. XXX:Untested */ |
+#elif defined(_MSC_VER) |
+#include <stdlib.h> |
+#define flac_max(a,b) __max(a,b) |
+#define flac_min(a,b) __min(a,b) |
#endif |
-typedef struct FLAC__StreamDecoderProtected { |
- FLAC__StreamDecoderState state; |
- unsigned channels; |
- FLAC__ChannelAssignment channel_assignment; |
- unsigned bits_per_sample; |
- unsigned sample_rate; /* in Hz */ |
- unsigned blocksize; /* in samples (per channel) */ |
- FLAC__bool md5_checking; /* if true, generate MD5 signature of decoded data and compare against signature in the STREAMINFO metadata block */ |
-#if FLAC__HAS_OGG |
- FLAC__OggDecoderAspect ogg_decoder_aspect; |
+#ifndef MIN |
+#define MIN(x,y) ((x) <= (y) ? (x) : (y)) |
#endif |
-} FLAC__StreamDecoderProtected; |
-/* |
- * return the number of input bytes consumed |
- */ |
-unsigned FLAC__stream_decoder_get_input_bytes_unconsumed(const FLAC__StreamDecoder *decoder); |
+#ifndef MAX |
+#define MAX(x,y) ((x) >= (y) ? (x) : (y)) |
+#endif |
#endif |