diff options
author | Max Kellermann <max@musicpd.org> | 2016-11-07 09:20:12 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2016-11-07 09:25:51 +0100 |
commit | d8b6aff23aa01fb26dfe52a0e0c6fbd485b87f39 (patch) | |
tree | dd935d5b843dcf7a921e789253993c1d258bb2c5 /src/encoder/EncoderInterface.hxx | |
parent | b8aac3f8fc27dbdc503aeb078b4d57f6a5a70266 (diff) |
encoder: migrate from class Error to C++ exceptions
Diffstat (limited to 'src/encoder/EncoderInterface.hxx')
-rw-r--r-- | src/encoder/EncoderInterface.hxx | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/src/encoder/EncoderInterface.hxx b/src/encoder/EncoderInterface.hxx index fccb5dff2..47f05c07d 100644 --- a/src/encoder/EncoderInterface.hxx +++ b/src/encoder/EncoderInterface.hxx @@ -28,7 +28,6 @@ struct AudioFormat; struct Tag; -class Error; class Encoder { const bool implements_tag; @@ -51,20 +50,18 @@ public: * usable for more data, and only Read() and Close() can be * called. * - * @return true on success + * Throws #std::runtime_error on error. */ - virtual bool End(gcc_unused Error &error) { - return true; + virtual void End() { } /** * Flushes an encoder object, make everything which might * currently be buffered available by Read(). * - * @return true on success + * Throws #std::runtime_error on error. */ - virtual bool Flush(gcc_unused Error &error) { - return true; + virtual void Flush() { } /** @@ -72,10 +69,9 @@ public: * some encoders to flush the previous sub-stream, in * preparation to begin a new one. * - * @return true on success + * Throws #std::runtime_error on error. */ - virtual bool PreTag(gcc_unused Error &error) { - return true; + virtual void PreTag() { } /** @@ -84,23 +80,22 @@ public: * Instructions: call PreTag(); then obtain flushed data with * Read(); finally call Tag(). * + * Throws #std::runtime_error on error. + * * @param tag the tag object - * @return true on success */ - virtual bool SendTag(gcc_unused const Tag &tag, - gcc_unused Error &error) { - return true; + virtual void SendTag(gcc_unused const Tag &tag) { } /** * Writes raw PCM data to the encoder. * + * Throws #std::runtime_error on error. + * * @param data the buffer containing PCM samples * @param length the length of the buffer in bytes - * @return true on success */ - virtual bool Write(const void *data, size_t length, - Error &error) = 0; + virtual void Write(const void *data, size_t length) = 0; /** * Reads encoded data from the encoder. @@ -127,11 +122,12 @@ public: * first encoder_write() call, you should invoke * encoder_read() to obtain the file header. * + * Throws #std::runtime_error on error. + * * @param audio_format the encoder's input audio format; the plugin * may modify the struct to adapt it to its abilities - * @return true on success */ - virtual Encoder *Open(AudioFormat &audio_format, Error &error) = 0; + virtual Encoder *Open(AudioFormat &audio_format) = 0; /** * Get mime type of encoded content. |