-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplayer-mp3.h
152 lines (139 loc) · 4.04 KB
/
player-mp3.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/*
* MP3/MPlayer plugin to VDR (C++)
*
* (C) 2001-2005 Stefan Huelswitt <s.huelswitt@gmx.de>
*
* This code is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This code is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* Or, point your browser to http://www.gnu.org/copyleft/gpl.html
*/
#ifndef ___DVB_MP3_H
#define ___DVB_MP3_H
#include <vdr/thread.h>
#include <vdr/player.h>
// -------------------------------------------------------------------
class cRingBufferFrame;
class cFrame;
class cPlayList;
class cSong;
class cSongInfo;
class cBackgroundScan;
class cDecoder;
class cOutputDvb;
class cShuffle;
// -------------------------------------------------------------------
class cMP3PlayInfo
{
public:
char Title[64], Artist[64], Album[64], SMode[32], Filename[256];
int Year, SampleFreq, Bitrate, MaxBitrate;
int Num, MaxNum;
// not in hash
bool Loop, Shuffle;
int Hash;
};
// -------------------------------------------------------------------
class cPlayManager:public cThread
{
private:
cMutex listMutex;
cCondVar fgCond, bgCond;
cList < cSong > list;
cSong *curr;
int currIndex, maxIndex;
//
cSong *play;
bool playNew, eol;
//
cShuffle *shuffle;
bool shuffleMode, loopMode;
//
cSong *scan;
bool stopscan, throttle, pass2, release;
//
virtual void Action( void );
void NoScan( cSong * nono );
void NoPlay( cSong * nono );
void ThrottleWait( void );
public:
cPlayManager( void );
~cPlayManager( );
// Control interface (to be called from frontend thread only!)
void Flush( void );
void Add( cPlayList * pl );
bool Next( void );
bool Prev( void );
void Goto( int num );
void ToggleShuffle( void );
void ToggleLoop( void );
bool Info( int num, cMP3PlayInfo * info );
void Halt( void );
// Player interface (to be called from player thread only!)
cSong *Current( void );
bool NewCurrent( void );
bool NextCurrent( void );
void Release( void );
void Throttle( bool thr );
};
extern cPlayManager *mgr;
// -------------------------------------------------------------------
class cMP3Player:public cPlayer, cThread
{
friend class cOutputDvb;
private:
bool active, started;
cRingBufferFrame *ringBuffer;
cMutex playModeMutex;
cCondVar playModeCond;
//
int playindex, total;
cDecoder *decoder;
cFrame *rframe, *pframe;
enum ePlayMode
{ pmPlay, pmStopped, pmPaused, pmStartup };
ePlayMode playMode;
enum eState
{ msStart, msStop, msDecode, msNormalize, msResample, msOutput, msError, msEof, msWait, msRestart };
eState state;
bool levelgood, isStream;
unsigned int dvbSampleRate;
//
void Empty( void );
void StopPlay( void );
void SetPlayMode( ePlayMode mode );
void WaitPlayMode( ePlayMode mode, bool inv );
protected:
virtual void Activate( bool On );
virtual void Action( void );
public:
cMP3Player( void );
virtual ~ cMP3Player( );
void Pause( void );
void Play( void );
bool PrevCheck( void );
void SkipSeconds( int secs );
virtual bool GetIndex( int &Current, int &Total, bool SnapToIFrame = false );
virtual bool GetReplayMode( bool & Play, bool & Forward, int &Speed );
bool Active( void )
{
return active;
}
bool IsStream( void )
{
return isStream;
}
char *CheckImage( char *fileName, size_t j );
void LoadImage( const char *fullname );
};
#endif //___DVB_MP3_H