/* libFLAC++ - Free Lossless Audio Codec library
- * Copyright (C) 2002,2003,2004,2005,2006 Josh Coalson
+ * Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009 Josh Coalson
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* property.
*
* Second, there are two stream decoder classes. FLAC::Decoder::Stream
- * is used for the same cases that FLAC__stream_decoder_init_stream() is
- * used, and FLAC::Decoder::File is used for the same cases that
- * FLAC__stream_decoder_init_FILE() and FLAC__stream_decoder_init_file()
+ * is used for the same cases that FLAC__stream_decoder_init_stream() /
+ * FLAC__stream_decoder_init_ogg_stream() are used, and FLAC::Decoder::File
+ * is used for the same cases that
+ * FLAC__stream_decoder_init_FILE() and FLAC__stream_decoder_init_file() /
+ * FLAC__stream_decoder_init_ogg_FILE() and FLAC__stream_decoder_init_ogg_file()
* are used.
*/
namespace FLAC {
namespace Decoder {
- /** \defgroup flacpp_stream_decoder FLAC++/decoder.h: stream decoder class
- * \ingroup flacpp_decoder
- *
+ /** \ingroup flacpp_decoder
* \brief
- * This class wraps the ::FLAC__StreamDecoder.
- *
- * See the \link flac_stream_decoder libFLAC stream decoder module \endlink
- * for basic usage.
- *
- * \{
- */
-
- /** This class wraps the ::FLAC__StreamDecoder. If you are
+ * This class wraps the ::FLAC__StreamDecoder. If you are
* decoding from a file, FLAC::Decoder::File may be more
* convenient.
*
* The usage of this class is similar to FLAC__StreamDecoder,
* except instead of providing callbacks to
- * FLAC__stream_decoder_init_stream(), you will inherit from this
+ * FLAC__stream_decoder_init*_stream(), you will inherit from this
* class and override the virtual callback functions with your
- * own implementations, then call Stream::init(). The rest of
- * the calls work the same as in the C layer.
+ * own implementations, then call init() or init_ogg(). The rest
+ * of the calls work the same as in the C layer.
*
* Only the read, write, and error callbacks are mandatory. The
* others are optional; this class provides default
* successfully. If not, use get_state() to find out why not.
*/
virtual bool is_valid() const;
- inline operator bool() const { return is_valid(); }
+ inline operator bool() const { return is_valid(); } ///< See is_valid()
//@}
- virtual bool set_serial_number(long value); ///< See FLAC__stream_decoder_set_serial_number()
+ virtual bool set_ogg_serial_number(long value); ///< See FLAC__stream_decoder_set_ogg_serial_number()
virtual bool set_md5_checking(bool value); ///< See FLAC__stream_decoder_set_md5_checking()
virtual bool set_metadata_respond(::FLAC__MetadataType type); ///< See FLAC__stream_decoder_set_metadata_respond()
virtual bool set_metadata_respond_application(const FLAC__byte id[4]); ///< See FLAC__stream_decoder_set_metadata_respond_application()
virtual unsigned get_bits_per_sample() const; ///< See FLAC__stream_decoder_get_bits_per_sample()
virtual unsigned get_sample_rate() const; ///< See FLAC__stream_decoder_get_sample_rate()
virtual unsigned get_blocksize() const; ///< See FLAC__stream_decoder_get_blocksize()
+ virtual bool get_decode_position(FLAC__uint64 *position) const; ///< See FLAC__stream_decoder_get_decode_position()
virtual ::FLAC__StreamDecoderInitStatus init(); ///< Seek FLAC__stream_decoder_init_stream()
virtual ::FLAC__StreamDecoderInitStatus init_ogg(); ///< Seek FLAC__stream_decoder_init_ogg_stream()
- virtual void finish(); ///< See FLAC__stream_decoder_finish()
+ virtual bool finish(); ///< See FLAC__stream_decoder_finish()
virtual bool flush(); ///< See FLAC__stream_decoder_flush()
virtual bool reset(); ///< See FLAC__stream_decoder_reset()
virtual bool seek_absolute(FLAC__uint64 sample); ///< See FLAC__stream_decoder_seek_absolute()
protected:
/// see FLAC__StreamDecoderReadCallback
- virtual ::FLAC__StreamDecoderReadStatus read_callback(FLAC__byte buffer[], unsigned *bytes) = 0;
+ virtual ::FLAC__StreamDecoderReadStatus read_callback(FLAC__byte buffer[], size_t *bytes) = 0;
/// see FLAC__StreamDecoderSeekCallback
virtual ::FLAC__StreamDecoderSeekStatus seek_callback(FLAC__uint64 absolute_byte_offset);
/// see FLAC__StreamDecoderErrorCallback
virtual void error_callback(::FLAC__StreamDecoderErrorStatus status) = 0;
-#if (defined _MSC_VER) || (defined __GNUG__ && (__GNUG__ < 2 || (__GNUG__ == 2 && __GNUC_MINOR__ < 96))) || (defined __SUNPRO_CC)
+#if (defined _MSC_VER) || (defined __BORLANDC__) || (defined __GNUG__ && (__GNUG__ < 2 || (__GNUG__ == 2 && __GNUC_MINOR__ < 96))) || (defined __SUNPRO_CC)
// lame hack: some MSVC/GCC versions can't see a protected decoder_ from nested State::resolved_as_cstring()
friend State;
#endif
- // hackery solely for the use of libOggFLAC++
- Stream(::FLAC__StreamDecoder *);
-
::FLAC__StreamDecoder *decoder_;
- static ::FLAC__StreamDecoderReadStatus read_callback_(const ::FLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data);
+ static ::FLAC__StreamDecoderReadStatus read_callback_(const ::FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data);
static ::FLAC__StreamDecoderSeekStatus seek_callback_(const ::FLAC__StreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data);
static ::FLAC__StreamDecoderTellStatus tell_callback_(const ::FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data);
static ::FLAC__StreamDecoderLengthStatus length_callback_(const ::FLAC__StreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data);
void operator=(const Stream &);
};
- /* \} */
-
- /** \defgroup flacpp_file_decoder FLAC++/decoder.h: file decoder class
- * \ingroup flacpp_decoder
- *
+ /** \ingroup flacpp_decoder
* \brief
- * This class wraps the ::FLAC__StreamDecoder.
- *
- * See the \link flac_stream_decoder libFLAC stream decoder module \endlink
- * for basic usage.
- *
- * \{
- */
-
- /** This class wraps the ::FLAC__StreamDecoder. If you are
+ * This class wraps the ::FLAC__StreamDecoder. If you are
* not decoding from a file, you may need to use
* FLAC::Decoder::Stream.
*
* The usage of this class is similar to FLAC__StreamDecoder,
* except instead of providing callbacks to
- * FLAC__stream_decoder_init_FILE() or
- * FLAC__stream_decoder_init_file(), you will inherit from this
+ * FLAC__stream_decoder_init*_FILE() or
+ * FLAC__stream_decoder_init*_file(), you will inherit from this
* class and override the virtual callback functions with your
- * own implementations, then call File::init(). The rest of
- * the calls work the same as in the C layer.
+ * own implementations, then call init() or init_off(). The rest
+ * of the calls work the same as in the C layer.
*
* Only the write, and error callbacks from FLAC::Decoder::Stream
* are mandatory. The others are optional; this class provides
virtual ::FLAC__StreamDecoderInitStatus init_ogg(const std::string &filename); ///< See FLAC__stream_decoder_init_ogg_file()
protected:
// this is a dummy implementation to satisfy the pure virtual in Stream that is actually supplied internally by the C layer
- virtual ::FLAC__StreamDecoderReadStatus read_callback(FLAC__byte buffer[], unsigned *bytes);
+ virtual ::FLAC__StreamDecoderReadStatus read_callback(FLAC__byte buffer[], size_t *bytes);
private:
// Private and undefined so you can't use them:
File(const File &);
void operator=(const File &);
};
- /* \} */
-
}
}