summaryrefslogtreecommitdiffstats
path: root/vlc/build/patches/faad2_71chan_detection.patch
blob: 7b9aaf5db42434475dde69fcbc91ede837dd1651 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
--- faad2-2.7/libfaad/decoder.c	2009-02-05 01:51:03.000000000 +0100
+++ faad2/libfaad/decoder.c	2017-02-28 21:14:46.946234869 +0100
@@ -589,24 +589,30 @@
     if (hDecoder->pce_set)
     {
         uint8_t i, chpos = 0;
-        uint8_t chdir, back_center = 0;
+        uint8_t chdir, back_center = 0, total = 0;
 
         hInfo->num_front_channels = hDecoder->pce.num_front_channels;
+        total += hInfo->num_front_channels;
         hInfo->num_side_channels = hDecoder->pce.num_side_channels;
+        total += hInfo->num_side_channels;
         hInfo->num_back_channels = hDecoder->pce.num_back_channels;
+        total += hInfo->num_back_channels;
         hInfo->num_lfe_channels = hDecoder->pce.num_lfe_channels;
+        total += hInfo->num_lfe_channels;
 
         chdir = hInfo->num_front_channels;
         if (chdir & 1)
         {
 #if (defined(PS_DEC) || defined(DRM_PS))
-            /* When PS is enabled output is always stereo */
-            hInfo->channel_position[chpos++] = FRONT_CHANNEL_LEFT;
-            hInfo->channel_position[chpos++] = FRONT_CHANNEL_RIGHT;
-#else
+            if( total == 1 )
+            {
+                /* When PS is enabled output is always stereo */
+                hInfo->channel_position[chpos++] = FRONT_CHANNEL_LEFT;
+                hInfo->channel_position[chpos++] = FRONT_CHANNEL_RIGHT;
+            } else
+#endif
             hInfo->channel_position[chpos++] = FRONT_CHANNEL_CENTER;
             chdir--;
-#endif
         }
         for (i = 0; i < chdir; i += 2)
         {