From: Andre Noll Date: Sun, 8 Mar 2009 18:59:17 +0000 (+0100) Subject: afh: Introduce afh_get_largest_chunk_size(). X-Git-Tag: v0.3.4~48 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=42d5f658d742dad5b8caa2c2ab7ca62768b0b105 afh: Introduce afh_get_largest_chunk_size(). This will be needed by the fec code in order to validate the fec parameters. --- diff --git a/afh.h b/afh.h index 4e2020bb..35cc7ef1 100644 --- 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); diff --git a/afh_common.c b/afh_common.c index f7066cfc..aa7f3d92 100644 --- a/afh_common.c +++ b/afh_common.c @@ -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. *