]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
afh: Introduce afh_get_largest_chunk_size().
authorAndre Noll <maan@systemlinux.org>
Sun, 8 Mar 2009 18:59:17 +0000 (19:59 +0100)
committerAndre Noll <maan@systemlinux.org>
Sun, 8 Mar 2009 18:59:17 +0000 (19:59 +0100)
This will be needed by the fec code in order to validate the
fec parameters.

afh.h
afh_common.c

diff --git a/afh.h b/afh.h
index 4e2020bb914411e376d8f274f09df8f07830c010..35cc7ef102644f1c394db52cd6cd21af51395c21 100644 (file)
--- a/afh.h
+++ b/afh.h
@@ -102,6 +102,7 @@ int compute_afhi(const char *path, char *data, size_t size,
 const char *audio_format_name(int);
 void afh_get_chunk(long unsigned chunk_num, struct afh_info *afhi,
                void *map, const char **buf, size_t *len);
+uint32_t afh_get_largest_chunk_size(struct afh_info *afhi);
 void afh_get_header(struct afh_info *afhi, void *map, const char **buf, size_t *len);
 char *make_taginfo(char *title, char *artist, char *album, char *year,
                char *comment);
index f7066cfc23e9246b707ad51fe4aa42681fe497d1..aa7f3d92444faddf9d193aa6c2b86fe04b697d14 100644 (file)
@@ -233,6 +233,15 @@ void afh_get_chunk(long unsigned chunk_num, struct afh_info *afhi,
        *len = afhi->chunk_table[chunk_num + 1] - pos;
 }
 
+uint32_t afh_get_largest_chunk_size(struct afh_info *afhi)
+{
+       uint32_t n, largest = 0, *ct = afhi->chunk_table;
+
+       for (n = 1; n <= afhi->chunks_total; n++)
+               largest = PARA_MAX(largest, ct[n] - ct[n - 1]);
+       return largest;
+}
+
 /**
  * Get the header of an audio file.
  *