"%s: %" PRIu32 "\n" /* seconds total */
"%s: %lu: %lu\n" /* chunk time */
"%s: %" PRIu32 "\n" /* num chunks */
+ "%s: %" PRIu32 "\n" /* max chunk size */
"%s: %s\n" /* techinfo */
"%s: %s\n" /* artist */
"%s: %s\n" /* title */
status_item_list[SI_CHUNK_TIME], (long unsigned)afhi->chunk_tv.tv_sec,
(long unsigned)afhi->chunk_tv.tv_usec,
status_item_list[SI_NUM_CHUNKS], afhi->chunks_total,
+ status_item_list[SI_MAX_CHUNK_SIZE], afhi->max_chunk_size,
status_item_list[SI_TECHINFO], afhi->techinfo? afhi->techinfo : "",
status_item_list[SI_ARTIST], afhi->tags.artist? afhi->tags.artist : "",
status_item_list[SI_TITLE], afhi->tags.title? afhi->tags.title : "",
);
}
+/**
+ * Determine the maximal chunk size by investigating the chunk table.
+ *
+ * \param afhi Value/result.
+ *
+ * This function iterates over the chunk table and sets ->max_chunk_size
+ * accordingly. The function exists only for backward compatibility since as of
+ * version 0.6.0, para_server stores the maximal chunk size in its database.
+ * This function is only called if the database value is zero, indicating that
+ * the file was added by an older server version.
+ */
+void set_max_chunk_size(struct afh_info *afhi)
+{
+ uint32_t n, max = 0, old = 0;
+
+ for (n = 0; n <= afhi->chunks_total; n++) {
+ uint32_t val = afhi->chunk_table[n];
+ /*
+ * If the first chunk is the header, do not consider it for the
+ * calculation of the largest chunk size.
+ */
+ if (n == 0 || (n == 1 && afhi->header_len > 0)) {
+ old = val;
+ continue;
+ }
+ max = PARA_MAX(max, val - old);
+ old = val;
+ }
+ afhi->max_chunk_size = max;
+}
+
/**
* Create a copy of the given file with altered meta tags.
*