]> git.tdb.fi Git - libs/al.git/blobdiff - source/vorbis/oggdecoder.h
Make sound format support optional
[libs/al.git] / source / vorbis / oggdecoder.h
diff --git a/source/vorbis/oggdecoder.h b/source/vorbis/oggdecoder.h
new file mode 100644 (file)
index 0000000..0d19d45
--- /dev/null
@@ -0,0 +1,45 @@
+#ifndef MSP_AL_OGGDECODER_H_
+#define MSP_AL_OGGDECODER_H_
+
+#include <stdexcept>
+#include <msp/al/sounddecoder.h>
+
+namespace Msp {
+namespace AL {
+
+class ogg_error: public std::runtime_error
+{
+public:
+       ogg_error(const std::string &, int);
+       virtual ~ogg_error() throw() { }
+
+private:
+       static std::string get_message(int);
+};
+
+
+/**
+Decoder for Ogg Vorbis files.  Normally you should use one of the
+SoundDecoder::open_* functions to create a decoder.
+*/
+class OggDecoder: public SoundDecoder
+{
+private:
+       struct Private;
+
+       Private *priv;
+
+public:
+       OggDecoder(IO::Seekable &);
+       ~OggDecoder();
+
+       static bool detect(const std::string &);
+
+       virtual void seek(unsigned);
+       virtual unsigned read(char *, unsigned);
+};
+
+} // namespace AL
+} // namespace Msp
+
+#endif