diff options
| author | lvw <lvw@e10066b5-e1e2-0310-b819-94efdf66514b> | 2004-05-28 15:29:19 +0000 |
|---|---|---|
| committer | lvw <lvw@e10066b5-e1e2-0310-b819-94efdf66514b> | 2004-05-28 15:29:19 +0000 |
| commit | ccb8abb73462a314a3bab3bdd3d22213325ed930 (patch) | |
| tree | a810f08c6d614d20f3f90798fcf5b32d443bd0ff /muggle-plugin/vdr_decoder_mp3.h | |
| parent | c761f82e6af237a9e3df4501e54890239d02c1b5 (diff) | |
| download | vdr-plugin-muggle-ccb8abb73462a314a3bab3bdd3d22213325ed930.tar.gz vdr-plugin-muggle-ccb8abb73462a314a3bab3bdd3d22213325ed930.tar.bz2 | |
Merged player branch back on HEAD branch.
git-svn-id: https://vdr-muggle.svn.sourceforge.net/svnroot/vdr-muggle/trunk@98 e10066b5-e1e2-0310-b819-94efdf66514b
Diffstat (limited to 'muggle-plugin/vdr_decoder_mp3.h')
| -rw-r--r-- | muggle-plugin/vdr_decoder_mp3.h | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/muggle-plugin/vdr_decoder_mp3.h b/muggle-plugin/vdr_decoder_mp3.h new file mode 100644 index 0000000..abc8eed --- /dev/null +++ b/muggle-plugin/vdr_decoder_mp3.h @@ -0,0 +1,114 @@ +/*! + * \file vdr_decoder_mp3.h + * \brief An mp3 decoder for a VDR media plugin (muggle) + * + * \version $Revision: 1.2 $ + * \date $Date: 2004/05/28 15:29:19 $ + * \author Ralf Klueber, Lars von Wedel, Andreas Kellner + * \author Responsible author: $Author: lvw $ + * + * $Id: vdr_decoder_mp3.h,v 1.2 2004/05/28 15:29:19 lvw Exp $ + * + * Adapted from + * MP3/MPlayer plugin to VDR (C++) + * (C) 2001,2002 Stefan Huelswitt <huels@iname.com> + */ + +#ifndef ___DECODER_MP3_H +#define ___DECODER_MP3_H + +#define DEC_MP3 DEC_ID('M','P','3',' ') +#define DEC_MP3_STR "MP3" + +#include <mad.h> +#include <string> + +#include "vdr_decoder.h" + +#if MAD_F_FRACBITS != 28 +#warning libmad with MAD_F_FRACBITS != 28 not tested +#endif + +class mgStream; + +// ---------------------------------------------------------------- + +/*! + * \brief A class to decode mp3 songs into PCM using libmad + */ +class mgMP3Decoder : public mgDecoder +{ +private: + struct mgDecode m_ds; + + // + struct mad_stream m_madstream; + struct mad_frame *m_madframe; + struct mad_synth *m_madsynth; + mad_timer_t m_playtime, m_skiptime; + + // + struct FrameInfo + { + unsigned long long Pos; + mad_timer_t Time; + } *m_frameinfo; + + int m_framenum, m_framemax, m_errcount, m_mute; + // + void init(); + + void clean(); + + struct mgDecode *done( eDecodeStatus status ); + + virtual mgPlayInfo *playInfo(); + + eDecodeStatus decodeError(bool hdr); + + void makeSkipTime(mad_timer_t *skiptime, mad_timer_t playtime, + int secs, int avail, int dvbrate); + +protected: + mgStream *m_stream; + bool m_isStream; + +public: + + /*! + * \brief construct a decoder from a filename + */ + mgMP3Decoder( std::string filename, bool preinit = true ); + + /*! + * \brief the destructor + */ + virtual ~mgMP3Decoder(); + + /*! + * \brief check, whether the file contains useable MP3 content + */ + virtual bool valid(); + + /*! + * \brief start the decoding process + */ + virtual bool start(); + + /*! + * \brief stop the decoding process + */ + virtual bool stop(); + + /*! + * \brief skip an amount of seconds + */ + virtual bool skip( int seconds, int avail, int rate ); + + /*! + * \brief the actual decoding function (uses libmad) + */ + virtual struct mgDecode *decode(); +}; + +#endif //___DECODER_MP3_H |
