From b1233925928b86a4ff1acb0028f3c8d3b1b2e5e1 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 10 Jul 2014 10:33:43 +0200 Subject: input/async: more API documentation --- src/input/AsyncInputStream.hxx | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/input') diff --git a/src/input/AsyncInputStream.hxx b/src/input/AsyncInputStream.hxx index c2055c17d..6e0031a0a 100644 --- a/src/input/AsyncInputStream.hxx +++ b/src/input/AsyncInputStream.hxx @@ -78,14 +78,25 @@ public: size_t Read(void *ptr, size_t read_size, Error &error) final; protected: + /** + * Pass an tag from the I/O thread to the client thread. + */ void SetTag(Tag *_tag); void Pause(); + /** + * Declare that the underlying stream was closed. We will + * continue feeding Read() calls from the buffer until it runs + * empty. + */ void SetClosed() { open = false; } + /** + * Pass an error from the I/O thread to the client thread. + */ void PostponeError(Error &&error); bool IsBufferEmpty() const { @@ -96,13 +107,24 @@ protected: return buffer.IsFull(); } + /** + * Determine how many bytes can be added to the buffer. + */ gcc_pure size_t GetBufferSpace() const { return buffer.GetSpace(); } + /** + * Append data to the buffer. The size must fit into the + * buffer; see GetBufferSpace(). + */ void AppendToBuffer(const void *data, size_t append_size); + /** + * Implement code here that will resume the stream after it + * has been paused due to full input buffer. + */ virtual void DoResume() = 0; /** @@ -116,6 +138,10 @@ protected: return seek_state == SeekState::PENDING; } + /** + * Call this after seeking has finished. It will notify the + * client thread. + */ void SeekDone(); private: -- cgit v1.2.3