changeset 9842:32d100ad81a6 libavcodec

Add additional sample rates to the frame len bits calculation code
author faust3
date Fri, 12 Jun 2009 15:38:11 +0000
parents 39bb2646fe00
children 893b27768692
files wma.c
diffstat 1 files changed, 17 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/wma.c	Fri Jun 12 15:21:43 2009 +0000
+++ b/wma.c	Fri Jun 12 15:38:11 2009 +0000
@@ -80,8 +80,24 @@
     else if (sample_rate <= 22050 ||
              (sample_rate <= 32000 && version == 1))
         frame_len_bits = 10;
-    else
+    else if (sample_rate <= 48000) {
         frame_len_bits = 11;
+    } else if (sample_rate <= 96000) {
+        frame_len_bits = 12;
+    } else {
+        frame_len_bits = 13;
+    }
+
+    if (version == 3) {
+        int tmp = decode_flags & 0x6;
+        if (tmp == 0x2) {
+            ++frame_len_bits;
+        } else if (tmp == 0x4) {
+            --frame_len_bits;
+        } else if (tmp == 0x6) {
+            frame_len_bits -= 2;
+        }
+    }
 
     return frame_len_bits;
 }