shithub: mp3dec

Download patch

ref: 86d13938f447e5986f705a6bbfac760337396397
parent: 45a1de9792aa8402af620bd1dc2b2d7bb9a3c62a
author: lieff <lieff@users.noreply.github.com>
date: Fri Aug 3 19:21:52 EDT 2018

readme: add high-level API doc.

--- a/README.md
+++ b/README.md
@@ -149,6 +149,32 @@
 positions as ``frame_bytes * N``. However, because of padding, frames can differ
 in size even in this case.
 
+## High-level API
+
+If you need only decode file/buffer, you can use optional high-level API.
+Just ``#include`` ``minimp3_ex.h`` instead and use following additional functions:
+
+```
+typedef struct
+{
+    int16_t *buffer;
+    size_t samples; /* channels included, byte size = samples*sizeof(int16_t) */
+    int channels, hz, layer, avg_bitrate_kbps;
+} mp3dec_file_info_t;
+
+/* decode whole buffer block */
+void mp3dec_load_buf(mp3dec_t *dec, const uint8_t *buf, size_t buf_size, mp3dec_file_info_t *info);
+/* iterate through frames with optional decoding */
+void mp3dec_iterate_buf(const uint8_t *buf, size_t buf_size, MP3D_ITERATE_CB callback, void *user_data);
+#ifndef MINIMP3_NO_STDIO
+/* stdio versions with file pre-load */
+int mp3dec_iterate(const char *file_name, MP3D_ITERATE_CB callback, void *user_data);
+int mp3dec_load(mp3dec_t *dec, const char *file_name, mp3dec_file_info_t *info);
+#endif
+```
+
+Use MINIMP3_NO_STDIO define to exclude STDIO functions.
+
 ## Bindings
 
  * https://github.com/tosone/minimp3 - go bindings