]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - afh_common.c
fecdec: Wait until the second FEC group is complete.
[paraslash.git] / afh_common.c
index f7066cfc23e9246b707ad51fe4aa42681fe497d1..7d4ab08952dbb259075b96f73e228f81da7db8e9 100644 (file)
@@ -208,9 +208,9 @@ int compute_afhi(const char *path, char *data, size_t size, int fd,
  */
 const char *audio_format_name(int i)
 {
-       //PARA_NOTICE_LOG("array size: %u¸ requested: %d\n", ARRAY_SIZE(afl), i);
-       assert(i < 0 || i < ARRAY_SIZE(afl) - 1);
-       return i >= 0?  afl[i].name : "(none)";
+       if (i < 0 || i >= ARRAY_SIZE(afl) - 1)
+               return "???";
+       return afl[i].name;
 }
 
 /**
@@ -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.
  *
@@ -247,9 +256,10 @@ void afh_get_chunk(long unsigned chunk_num, struct afh_info *afhi,
  */
 void afh_get_header(struct afh_info *afhi, void *map, const char **buf, size_t *len)
 {
-       if (!map || !afhi || ! afhi->header_len) {
+       if (!map || !afhi || !afhi->header_len) {
                *buf = NULL;
                *len = 0;
+               return;
        }
        *len = afhi->header_len;
        *buf = map + afhi->header_offset;