[xiph-commits] r17470 - trunk/ffmpeg2theora/src

j at svn.xiph.org j at svn.xiph.org
Sat Sep 25 09:22:07 PDT 2010


Author: j
Date: 2010-09-25 09:22:07 -0700 (Sat, 25 Sep 2010)
New Revision: 17470

Modified:
   trunk/ffmpeg2theora/src/theorautils.c
Log:
5.1 channel ordering, fixes lp:507790

Modified: trunk/ffmpeg2theora/src/theorautils.c
===================================================================
--- trunk/ffmpeg2theora/src/theorautils.c	2010-09-25 15:56:06 UTC (rev 17469)
+++ trunk/ffmpeg2theora/src/theorautils.c	2010-09-25 16:22:07 UTC (rev 17470)
@@ -1215,7 +1215,7 @@
 void oggmux_add_audio (oggmux_info *info, int16_t * buffer, int bytes, int samples, int e_o_s) {
     ogg_packet op;
 
-    int i,j, count = 0;
+    int i, j, k, count = 0;
     float **vorbis_buffer;
 
     if (bytes <= 0 && samples <= 0) {
@@ -1228,7 +1228,20 @@
         /* uninterleave samples */
         for (i = 0; i < samples; i++) {
             for (j=0;j<info->channels;j++) {
-                vorbis_buffer[j][i] = buffer[count++] / 32768.f;
+                k = j;
+                /* 5.1 input: [fl, fr, c, lfe, rl, rr] */
+                if(info->channels == 6) {
+                    switch(j) {
+                        case 0: k = 0; break;
+                        case 1: k = 2; break;
+                        case 2: k = 1; break;
+                        case 3: k = 5; break;
+                        case 4: k = 3; break;
+                        case 5: k = 4; break;
+                        default: k = j;
+                    }
+                }
+                vorbis_buffer[k][i] = buffer[count++] / 32768.f;
             }
         }
         vorbis_analysis_wrote (&info->vd, samples);



More information about the commits mailing list