This allows unconditionally including the public header and cleaning up
some duplicated declarations. It also allows cleanly eliminating
redefined typedefs for fft-related context structs.
---

This is the cleanest solution to the redefined typedefs that I found.
All headers work standalone now and some silly duplication is eliminated.

It modifies a public header, so some version bump might be necessary,
maybe also some prefixing of defines.

 libavcodec/avfft.h | 12 ++++++++++++
 libavcodec/dct.h   |  1 +
 libavcodec/fft.h   | 13 +++----------
 3 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/libavcodec/avfft.h b/libavcodec/avfft.h
index e2e727d..86821e7 100644
--- a/libavcodec/avfft.h
+++ b/libavcodec/avfft.h
@@ -32,8 +32,20 @@
  * @{
  */
 
+#ifndef FFT_FLOAT
+#define FFT_FLOAT 1
+#endif
+
+#if FFT_FLOAT
+
 typedef float FFTSample;
 
+#else
+
+typedef int16_t FFTSample;
+
+#endif /* FFT_FLOAT */
+
 typedef struct FFTComplex {
     FFTSample re, im;
 } FFTComplex;
diff --git a/libavcodec/dct.h b/libavcodec/dct.h
index 24926a7..4f18312 100644
--- a/libavcodec/dct.h
+++ b/libavcodec/dct.h
@@ -26,6 +26,7 @@
 
 #include <stdint.h>
 
+#include "avfft.h"
 #include "rdft.h"
 
 typedef struct DCTContext {
diff --git a/libavcodec/fft.h b/libavcodec/fft.h
index 7daae24..716a1ba 100644
--- a/libavcodec/fft.h
+++ b/libavcodec/fft.h
@@ -30,10 +30,10 @@
 #include "config.h"
 #include "libavutil/mem.h"
 
-#if FFT_FLOAT
-
 #include "avfft.h"
 
+#if FFT_FLOAT
+
 #define FFT_NAME(x) x
 
 typedef float FFTDouble;
@@ -42,14 +42,7 @@ typedef float FFTDouble;
 
 #define FFT_NAME(x) x ## _fixed
 
-typedef int16_t FFTSample;
-typedef int     FFTDouble;
-
-typedef struct FFTComplex {
-    int16_t re, im;
-} FFTComplex;
-
-typedef struct FFTContext FFTContext;
+typedef int FFTDouble;
 
 #endif /* FFT_FLOAT */
 
-- 
1.8.3.2

_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to