# HG changeset patch # User reimar # Date 1354306318 0 # Node ID 4644c320daf49e5d590b9b21941e5683cd85678f # Parent f045a1d92c069704a07e8fea19e266222db4e571 af_format: support endianness conversion also for iec61937 formats in general, not just AC3. diff -r f045a1d92c06 -r 4644c320daf4 libaf/af_format.c --- 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)) ||