diff options
author | LarsAC <LarsAC@e10066b5-e1e2-0310-b819-94efdf66514b> | 2005-03-22 06:47:53 +0000 |
---|---|---|
committer | LarsAC <LarsAC@e10066b5-e1e2-0310-b819-94efdf66514b> | 2005-03-22 06:47:53 +0000 |
commit | e2de0c5ed7bbbe4b236246e8bfd71cc87c8d974f (patch) | |
tree | 616f2f0a482597e3968e281ccf8adcfd04f45bbc /muggle-plugin/vdr_decoder_mp3.h | |
parent | 101360901576c7e91196de60e2e6ebd6a4b145dd (diff) | |
download | vdr-plugin-muggle-e2de0c5ed7bbbe4b236246e8bfd71cc87c8d974f.tar.gz vdr-plugin-muggle-e2de0c5ed7bbbe4b236246e8bfd71cc87c8d974f.tar.bz2 |
Added 0.1.6 beta tag0.1.6-BETA
git-svn-id: https://vdr-muggle.svn.sourceforge.net/svnroot/vdr-muggle/tags/0.1.6-BETA@586 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..47d6eb2 --- /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$ + * \author Ralf Klueber, Lars von Wedel, Andreas Kellner + * \author Responsible author: $Author$ + * + * $Id$ + * + * 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; +class mgContentItem; + +// ---------------------------------------------------------------- + +/*! + * \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 (mgContentItem * item, 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 |