From 05801055e91bef231bb6aa48a96034e69bd7f250 Mon Sep 17 00:00:00 2001 From: LarsAC Date: Sun, 23 Jan 2005 13:03:34 +0000 Subject: Merged branches osd_extensions and flac_player for new release, yet untested git-svn-id: https://vdr-muggle.svn.sourceforge.net/svnroot/vdr-muggle/trunk/muggle-plugin@386 e10066b5-e1e2-0310-b819-94efdf66514b --- vdr_decoder_flac.h | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 vdr_decoder_flac.h (limited to 'vdr_decoder_flac.h') diff --git a/vdr_decoder_flac.h b/vdr_decoder_flac.h new file mode 100644 index 0000000..581d1af --- /dev/null +++ b/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