From e2de0c5ed7bbbe4b236246e8bfd71cc87c8d974f Mon Sep 17 00:00:00 2001 From: LarsAC Date: Tue, 22 Mar 2005 06:47:53 +0000 Subject: Added 0.1.6 beta tag git-svn-id: https://vdr-muggle.svn.sourceforge.net/svnroot/vdr-muggle/tags/0.1.6-BETA@586 e10066b5-e1e2-0310-b819-94efdf66514b --- muggle-plugin/vdr_decoder_flac.h | 80 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 muggle-plugin/vdr_decoder_flac.h (limited to 'muggle-plugin/vdr_decoder_flac.h') diff --git a/muggle-plugin/vdr_decoder_flac.h b/muggle-plugin/vdr_decoder_flac.h new file mode 100644 index 0000000..581d1af --- /dev/null +++ b/muggle-plugin/vdr_decoder_flac.h @@ -0,0 +1,80 @@ +/*! \file vdr_decoder_flac.h + * \ingroup vdr + * + * The file contains a decoder which is used by the player to decode flac audio files. + * + * Based on code from + * MP3/MPlayer plugin to VDR (C++) + * (C) 2001-2003 Stefan Huelswitt + */ + +#ifndef ___DECODER_FLAC_H +#define ___DECODER_FLAC_H + +#define DEC_FLAC DEC_ID('F','L','A','C') +#define DEC_FLAC_STR "FLAC" + +#ifdef HAVE_FLAC + +#include "vdr_decoder.h" +#include + +// ---------------------------------------------------------------- + +class mgFlacDecoder : public mgDecoder, + public FLAC::Decoder::File +{ + private: + + struct mgDecode m_ds; + struct mad_pcm *m_pcm; + unsigned long long m_index, m_current_time_ms, m_current_samples; + unsigned int m_reservoir_count, m_len_decoded, m_samplerate; + + long m_nCurrentSampleRate, m_nCurrentChannels, m_nCurrentBitsPerSample; + long m_nLengthMS, m_nBlockAlign, m_nAverageBitRate, m_nCurrentBitrate; + long m_nTotalSamples, m_nBitsPerSample, m_nFrameSize, m_nBlockSize; + + bool m_state, m_first, m_continue; + std::string m_error; + + FLAC__int32 **m_reservoir; + + bool initialize(); + bool clean(); + + struct mgDecode* done(eDecodeStatus status); + eDecodeStatus m_decode_status; + + protected: + + /*! \brief FLAC decoder callback routines */ + //@{ + virtual ::FLAC__StreamDecoderWriteStatus write_callback(const ::FLAC__Frame *frame, + const FLAC__int32 * const buffer[]); + virtual void metadata_callback(const ::FLAC__StreamMetadata *metadata); + virtual void error_callback(::FLAC__StreamDecoderErrorStatus status); + //@} + + public: + + mgFlacDecoder( mgContentItem *item ); + ~mgFlacDecoder(); + + virtual mgPlayInfo *playInfo(); + + virtual bool valid(); + + virtual bool start(); + + virtual struct mgDecode *decode(void); + + virtual bool skip(int Seconds, int Avail, int Rate); + + virtual bool stop(); +}; + +// ---------------------------------------------------------------- + +#endif //HAVE_FLAC +#endif //___DECODER_FLAC_H -- cgit v1.2.3