All pastes #769457 Raw Edit

Something

public text v1 · immutable
·published 2007-11-11 13:20 UTC
rendered paste body
diff --git a/libaf/af.h b/libaf/af.h
index a4dc6f9..a0fcf1b 100644
--- a/libaf/af.h
+++ b/libaf/af.h
@@ -16,8 +16,13 @@ struct af_instance_s;
 #endif
 
 // Audio data chunk
+// For planar formats, if audio is non-null this is the backing storage
+// for all data in channels, otherwise each pointer in channels is
+// allocated separately.
 typedef struct af_data_s
 {
+  void *channels[AF_CHANNEL_TYPE_COUNT]; // data buffers for planar
+  int samples;  // number of samples in buffer
   void* audio;  // data buffer
   int len;      // buffer length
   int rate;    // sample rate
diff --git a/libaf/af_format.h b/libaf/af_format.h
index 1cc26c3..6f24459 100644
--- a/libaf/af_format.h
+++ b/libaf/af_format.h
@@ -46,6 +46,23 @@
 #define AF_FORMAT_IMA_ADPCM    (5<<6)
 #define AF_FORMAT_SPECIAL_MASK (7<<6)
 
+// Planar or interleaved
+#define AF_FORMAT_INTERLEAVED   (0 << 10)
+#define AF_FORMAT_PLANAR        (1 << 10)
+#define AF_FORMAT_PLANAR_MASK   (1 << 10)
+
+enum {
+  AF_CHANNEL_LEFT = 0,
+  AF_CHANNEL_RIGHT,
+  AF_CHANNEL_LEFT_REAR,
+  AF_CHANNEL_RIGHT_REAR,
+  AF_CHANNEL_LEFT_SIDE,
+  AF_CHANNEL_RIGHT_SIDE,
+  AF_CHANNEL_CENTER,
+  AF_CHANNEL_LFE,
+  AF_CHANNEL_TYPE_COUNT
+}
+
 // PREDEFINED formats
 
 #define AF_FORMAT_U8           (AF_FORMAT_I|AF_FORMAT_US|AF_FORMAT_8BIT|AF_FORMAT_NE)