diff libaf/af_format.c @ 35444:4644c320daf4

af_format: support endianness conversion also for iec61937 formats in general, not just AC3.
author reimar
date Fri, 30 Nov 2012 20:11:58 +0000
parents 6dc94af7016d
children 29f66b254dd7
line wrap: on
line diff
--- a/libaf/af_format.c	Fri Nov 30 20:10:40 2012 +0000
+++ b/libaf/af_format.c	Fri Nov 30 20:11:58 2012 +0000
@@ -94,14 +94,23 @@
     char buf1[256];
     char buf2[256];
     af_data_t *data = arg;
+    int supported_ac3 = 0;
 
     // Make sure this filter isn't redundant
     if(af->data->format == data->format &&
        af->data->bps == data->bps)
       return AF_DETACH;
 
+    // A bit complex because we can convert AC3
+    // to generic iec61937 but not the other way
+    // round.
+    if (AF_FORMAT_IS_AC3(af->data->format))
+      supported_ac3 = AF_FORMAT_IS_AC3(data->format);
+    else if (AF_FORMAT_IS_IEC61937(af->data->format))
+      supported_ac3 = AF_FORMAT_IS_IEC61937(data->format);
+
     // Allow trivial AC3-endianness conversion
-    if (!AF_FORMAT_IS_AC3(af->data->format) || !AF_FORMAT_IS_AC3(data->format))
+    if (!supported_ac3)
     // Check for errors in configuration
     if((AF_OK != check_bps(data->bps)) ||
        (AF_OK != check_format(data->format)) ||