[FFmpeg-soc] [soc]: r1947 - aac/aac.c

andoma subversion at mplayerhq.hu
Fri Feb 29 09:05:09 CET 2008


Author: andoma
Date: Fri Feb 29 09:05:09 2008
New Revision: 1947

Log:
Work around buggy stream which carries the LFE-channel in a secondary SCE
element rather than in the LFE element (as mandated by the standard)



Modified:
   aac/aac.c

Modified: aac/aac.c
==============================================================================
--- aac/aac.c	(original)
+++ aac/aac.c	Fri Feb 29 09:05:09 2008
@@ -2125,7 +2125,20 @@ static int aac_decode_frame(AVCodecConte
         tag = get_bits(&gb, 4);
         switch (id) {
         case ID_SCE:
-            err = ac->che_sce[tag] && !individual_channel_stream(ac, &gb, 0, 0, ac->che_sce[tag]) ? 0 : -1;
+            if(ac->che_sce[tag] == NULL) {
+                if(tag == 1 && ac->che_lfe[0] != NULL) {
+                    /* Some streams incorrectly code 5.1 audio as SCE[0] CPE[0] CPE[1] SCE[1]
+                       instead of SCE[0] CPE[0] CPE[0] LFE[0].
+                       If we seem to have encountered such a stream,
+                       transfer the LFE[0] element to SCE[1] */
+                    ac->che_sce[tag] = ac->che_lfe[0];
+                    ac->che_lfe[0] = NULL;
+                } else {
+                    err = 1;
+                    break;
+                }
+            }
+            err = individual_channel_stream(ac, &gb, 0, 0, ac->che_sce[tag]);
             break;
         case ID_CPE:
             err = channel_pair_element(ac, &gb, tag);



More information about the FFmpeg-soc mailing list