summaryrefslogtreecommitdiff
path: root/libavformat/avio.h
diff options
context:
space:
mode:
authorBryan Huh <bryan@box.com>2015-11-15 18:02:11 -0800
committerMichael Niedermayer <michael@niedermayer.cc>2015-11-16 12:14:03 +0100
commita01c24e8c591985b9aa17a8a1984b517541ef3be (patch)
tree8600cc247622117ec88316d3ab5f1fad624cbbe5 /libavformat/avio.h
parentc9944f75961038e0631efa6d3637b9438c6d6238 (diff)
downloadffmpeg-a01c24e8c591985b9aa17a8a1984b517541ef3be.tar.gz
avformat/aviobuf: Improve readability of aviobuf (Add comments and docs)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/avio.h')
-rw-r--r--libavformat/avio.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/libavformat/avio.h b/libavformat/avio.h
index 06dd7f5ef8..abe13b2719 100644
--- a/libavformat/avio.h
+++ b/libavformat/avio.h
@@ -122,6 +122,53 @@ typedef struct AVIOContext {
* to any av_opt_* functions in that case.
*/
const AVClass *av_class;
+
+ /*
+ * The following shows the relationship between buffer, buf_ptr, buf_end, buf_size,
+ * and pos, when reading and when writing (since AVIOContext is used for both):
+ *
+ **********************************************************************************
+ * READING
+ **********************************************************************************
+ *
+ * | buffer_size |
+ * |---------------------------------------|
+ * | |
+ *
+ * buffer buf_ptr buf_end
+ * +---------------+-----------------------+
+ * |/ / / / / / / /|/ / / / / / /| |
+ * read buffer: |/ / consumed / | to be read /| |
+ * |/ / / / / / / /|/ / / / / / /| |
+ * +---------------+-----------------------+
+ *
+ * pos
+ * +-------------------------------------------+-----------------+
+ * input file: | | |
+ * +-------------------------------------------+-----------------+
+ *
+ *
+ **********************************************************************************
+ * WRITING
+ **********************************************************************************
+ *
+ * | buffer_size |
+ * |-------------------------------|
+ * | |
+ *
+ * buffer buf_ptr buf_end
+ * +-------------------+-----------+
+ * |/ / / / / / / / / /| |
+ * write buffer: | / to be flushed / | |
+ * |/ / / / / / / / / /| |
+ * +-------------------+-----------+
+ *
+ * pos
+ * +--------------------------+-----------------------------------+
+ * output file: | | |
+ * +--------------------------+-----------------------------------+
+ *
+ */
unsigned char *buffer; /**< Start of the buffer. */
int buffer_size; /**< Maximum buffer size */
unsigned char *buf_ptr; /**< Current position in the buffer */