+static void get_chunk(long unsigned chunk_num, char **buf, size_t *len)
+{
+ size_t pos = mmd->afi.chunk_table[chunk_num];
+ *buf = map + pos;
+ *len = mmd->afi.chunk_table[chunk_num + 1] - pos;
+}
+
+/**
+ * Get the data of the given chunk.
+ *
+ * \param chunk_num The number of the desired chunk.
+ * \param buf Chunk data.
+ * \param len Chunk length in bytes.
+ *
+ * \return Positive on success, negative on errors.
+ */
+int vss_get_chunk(long unsigned chunk_num, char **buf, size_t *len)
+{
+ if (mmd->audio_format < 0 || !map || !vss_playing())
+ return -E_CHUNK;
+ if (chunk_num >= mmd->afi.chunks_total)
+ return -E_CHUNK;
+ get_chunk(chunk_num, buf, len);
+ return 1;
+}
+