]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/wma.c
libspeexdec: move the SpeexHeader from LibSpeexContext to where it is used
[ffmpeg] / libavcodec / wma.c
index 1746c73a791e750d52a2f18d9fdea1002c9fcc83..43714e7c84e22f736ca99836b7ceda79582183f7 100644 (file)
@@ -22,6 +22,7 @@
 #include "avcodec.h"
 #include "sinewin.h"
 #include "wma.h"
+#include "wma_common.h"
 #include "wmadata.h"
 
 #undef NDEBUG
@@ -67,46 +68,6 @@ static void init_coef_vlc(VLC *vlc, uint16_t **prun_table,
     av_free(level_table);
 }
 
-/**
- *@brief Get the samples per frame for this stream.
- *@param sample_rate output sample_rate
- *@param version wma version
- *@param decode_flags codec compression features
- *@return log2 of the number of output samples per frame
- */
-int av_cold ff_wma_get_frame_len_bits(int sample_rate, int version,
-                                      unsigned int decode_flags)
-{
-
-    int frame_len_bits;
-
-    if (sample_rate <= 16000) {
-        frame_len_bits = 9;
-    } else if (sample_rate <= 22050 ||
-             (sample_rate <= 32000 && version == 1)) {
-        frame_len_bits = 10;
-    } else if (sample_rate <= 48000 || version < 3) {
-        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;
-}
-
 int ff_wma_init(AVCodecContext *avctx, int flags2)
 {
     WMACodecContext *s = avctx->priv_data;
@@ -117,7 +78,7 @@ int ff_wma_init(AVCodecContext *avctx, int flags2)
     int coef_vlc_table;
 
     if (   avctx->sample_rate <= 0 || avctx->sample_rate > 50000
-        || avctx->channels    <= 0 || avctx->channels    > 8
+        || avctx->channels    <= 0 || avctx->channels    > 2
         || avctx->bit_rate    <= 0)
         return -1;
 
@@ -126,10 +87,10 @@ int ff_wma_init(AVCodecContext *avctx, int flags2)
     s->bit_rate    = avctx->bit_rate;
     s->block_align = avctx->block_align;
 
-    dsputil_init(&s->dsp, avctx);
+    ff_dsputil_init(&s->dsp, avctx);
     ff_fmt_convert_init(&s->fmt_conv, avctx);
 
-    if (avctx->codec->id == CODEC_ID_WMAV1) {
+    if (avctx->codec->id == AV_CODEC_ID_WMAV1) {
         s->version = 1;
     } else {
         s->version = 2;