encoder/Interface: update API docs

This commit is contained in:
Max Kellermann 2022-07-12 10:37:17 +02:00
parent eb7d321cb8
commit 0d09f307b2

View File

@ -41,11 +41,10 @@ public:
/** /**
* Ends the stream: flushes the encoder object, generate an * Ends the stream: flushes the encoder object, generate an
* end-of-stream marker (if applicable), make everything which * end-of-stream marker (if applicable), make everything which
* might currently be buffered available by encoder_read(). * might currently be buffered available by Read().
* *
* After this function has been called, the encoder may not be * After this function has been called, the encoder may not be
* usable for more data, and only Read() and Close() can be * usable for more data, and only Read() can be called.
* called.
* *
* Throws on error. * Throws on error.
*/ */
@ -75,7 +74,7 @@ public:
* Sends a tag to the encoder. * Sends a tag to the encoder.
* *
* Instructions: call PreTag(); then obtain flushed data with * Instructions: call PreTag(); then obtain flushed data with
* Read(); finally call Tag(). * Read(); finally call Tag() and again Read().
* *
* Throws on error. * Throws on error.
* *
@ -97,12 +96,13 @@ public:
/** /**
* Reads encoded data from the encoder. * Reads encoded data from the encoder.
* *
* Call this repeatedly until no more data is returned. * Call this repeatedly after End(), Flush(), PreTag(), SendTag() and
* Write() until no more data is returned.
* *
* @param buffer a buffer that can be used to write data into * @param buffer a buffer that can be used to write data into
* *
* @return the portion of the buffer that was filled (but may * @return the portion of the buffer that was filled (but may
* also point to a different buffer, e.g. one owned by this object) * also point to a different buffer, e.g. one owned by this object)
*/ */
virtual std::span<const std::byte> Read(std::span<std::byte> buffer) noexcept = 0; virtual std::span<const std::byte> Read(std::span<std::byte> buffer) noexcept = 0;
}; };
@ -112,13 +112,11 @@ public:
virtual ~PreparedEncoder() noexcept = default; virtual ~PreparedEncoder() noexcept = default;
/** /**
* Opens the object. You must call this prior to using it. * Create an #Encoder instance.
* Before you free it, you must call Close(). You may open
* and close (reuse) one encoder any number of times.
* *
* After this function returns successfully and before the * After this function returns successfully and before the
* first encoder_write() call, you should invoke * first Encoder::Write() call, you should invoke
* encoder_read() to obtain the file header. * Encoder::Read() to obtain the file header.
* *
* Throws on error. * Throws on error.
* *