2 * MP3/MPlayer plugin to VDR (C++)
4 * (C) 2001-2005 Stefan Huelswitt <s.huelswitt@gmx.de>
6 * This code is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This code is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
22 #ifndef ___DECODER_MP3_H
23 #define ___DECODER_MP3_H
25 #define DEC_MP3 DEC_ID('M','P','3',' ')
26 #define DEC_MP3_STR "MP3"
32 #include "decoder-core.h"
34 #if MAD_F_FRACBITS != 28
35 #warning libmad with MAD_F_FRACBITS != 28 not tested
40 // ----------------------------------------------------------------
42 class cScanID3 : public cSongInfo {
44 bool keepOpen, *urgent;
46 bool Abort(bool result);
47 struct id3_tag *GetID3(struct mad_stream *stream, id3_length_t tagsize) const;
48 void ParseID3(const struct id3_tag *tag);
49 void ParseStr(const struct id3_tag *tag, const char *id, char * &data);
50 void ParsePic(const struct id3_tag *tag, const char *id, char * &name);
51 int ParseXing(struct mad_bitptr *ptr, unsigned int bitlen) const;
55 cScanID3(cStream *Str, bool *Urgent);
56 virtual ~cScanID3() {}
57 virtual bool DoScan(bool KeepOpen=false);
58 virtual void InfoHook(struct mad_header *header) {}
61 // ----------------------------------------------------------------
63 class cMP3Decoder : public cDecoder {
67 struct mad_stream *stream;
68 struct mad_frame *frame;
69 struct mad_synth *synth;
70 mad_timer_t playtime, skiptime;
73 unsigned long long Pos;
76 int framenum, framemax, errcount, mute;
80 struct Decode *Done(eDecodeStatus status);
81 eDecodeStatus DecodeError(bool hdr);
82 void MakeSkipTime(mad_timer_t *skiptime, mad_timer_t playtime, int secs, float bsecs);
88 cMP3Decoder(const char *Filename, bool preinit=true);
89 virtual ~cMP3Decoder();
90 virtual bool Valid(void);
91 virtual cFileInfo *FileInfo(void);
92 virtual cSongInfo *SongInfo(bool get);
93 virtual cPlayInfo *PlayInfo(void);
94 virtual bool Start(void);
95 virtual bool Stop(void);
96 virtual bool Skip(int Seconds, float bsecs);
97 virtual struct Decode *Decode(void);
100 #endif //___DECODER_MP3_H