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
25 #include <vdr/thread.h>
26 #include <vdr/player.h>
28 // -------------------------------------------------------------------
30 class cRingBufferFrame;
36 class cBackgroundScan;
42 // -------------------------------------------------------------------
46 char Title[64], Artist[64], Album[64], SMode[32], Filename[256];
47 int Year, SampleFreq, Bitrate, MaxBitrate;
54 // -------------------------------------------------------------------
56 class cPlayManager : public cThread {
59 cCondVar fgCond, bgCond;
62 int currIndex, maxIndex;
68 bool shuffleMode, loopMode;
71 bool stopscan, throttle, pass2, release;
73 virtual void Action(void);
74 void NoScan(cSong *nono);
75 void NoPlay(cSong *nono);
76 void ThrottleWait(void);
80 // Control interface (to be called from frontend thread only!)
82 void Add(cPlayList *pl);
86 void ToggleShuffle(void);
87 void ToggleLoop(void);
88 bool Info(int num, cMP3PlayInfo *info);
90 // Player interface (to be called from player thread only!)
92 bool NewCurrent(void);
93 bool NextCurrent(void);
95 void Throttle(bool thr);
98 extern cPlayManager *mgr;
100 // -------------------------------------------------------------------
102 class cMP3Player : public cPlayer, cThread {
103 friend class cOutputDvb;
105 bool active, started;
106 cRingBufferFrame *ringBuffer;
107 cMutex playModeMutex;
108 cCondVar playModeCond;
110 int playindex, total;
113 cFrame *rframe, *pframe;
114 enum ePlayMode { pmPlay, pmStopped, pmPaused, pmStartup };
116 enum eState { msStart, msStop, msDecode, msNormalize, msResample, msOutput, msError, msEof, msWait, msRestart };
118 bool levelgood, isStream;
119 unsigned int dvbSampleRate;
123 void SetPlayMode(ePlayMode mode);
124 void WaitPlayMode(ePlayMode mode, bool inv);
126 virtual void Activate(bool On);
127 virtual void Action(void);
130 virtual ~cMP3Player();
133 bool PrevCheck(void);
134 void SkipSeconds(int secs);
135 virtual bool GetIndex(int &Current, int &Total, bool SnapToIFrame=false);
136 virtual bool GetReplayMode(bool &Play, bool &Forward, int &Speed);
137 bool Active(void) { return active; }
138 bool IsStream(void) { return isStream; }
141 #endif //___DVB_MP3_H