]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - wma_afh.c
Merge branch 'refs/heads/t/dynamic_chunks'
[paraslash.git] / wma_afh.c
index 4c9d87e047af8d1d5873096db54ab4a9d17ab966..6bf2d64134539f07237fb31db9a83a7629db3f83 100644 (file)
--- a/wma_afh.c
+++ b/wma_afh.c
@@ -38,8 +38,7 @@ static int count_frames(const char *buf, int buf_size, uint32_t packet_size,
                sfc++;
        }
        PARA_INFO_LOG("%d frames, %d superframes\n", fc, sfc);
-       if (num_superframes)
-               *num_superframes = sfc;
+       *num_superframes = sfc;
        return fc;
 }
 
@@ -68,7 +67,7 @@ static int put_utf8(uint32_t val, char *result)
                *out++ = in;
                return 1;
        }
-       bytes = (wma_log2(in) + 4) / 5;
+       bytes = DIV_ROUND_UP(wma_log2(in), 5);
        shift = (bytes - 1) * 6;
        *out++ = (256 - (256 >> bytes)) | (in >> shift);
        while (shift >= 6) {
@@ -229,6 +228,7 @@ static int wma_make_chunk_table(char *buf, size_t buf_size, uint32_t packet_size
                }
        }
        afhi->chunks_total = j;
+       set_max_chunk_size(afhi);
        set_chunk_tv(frames_per_chunk, afhi->frequency, &afhi->chunk_tv);
        return 1;
 fail: