nathan@0
|
1 |
/*
|
nathan@0
|
2 |
* MP3/MPlayer plugin to VDR (C++)
|
nathan@0
|
3 |
*
|
nathan@0
|
4 |
* (C) 2001-2006 Stefan Huelswitt <s.huelswitt@gmx.de>
|
nathan@0
|
5 |
*
|
nathan@0
|
6 |
* This code is free software; you can redistribute it and/or
|
nathan@0
|
7 |
* modify it under the terms of the GNU General Public License
|
nathan@0
|
8 |
* as published by the Free Software Foundation; either version 2
|
nathan@0
|
9 |
* of the License, or (at your option) any later version.
|
nathan@0
|
10 |
*
|
nathan@0
|
11 |
* This code is distributed in the hope that it will be useful,
|
nathan@0
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
nathan@0
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
nathan@0
|
14 |
* GNU General Public License for more details.
|
nathan@0
|
15 |
*
|
nathan@0
|
16 |
* You should have received a copy of the GNU General Public License
|
nathan@0
|
17 |
* along with this program; if not, write to the Free Software
|
nathan@0
|
18 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
nathan@0
|
19 |
* Or, point your browser to http://www.gnu.org/copyleft/gpl.html
|
nathan@0
|
20 |
*/
|
nathan@0
|
21 |
|
nathan@0
|
22 |
#ifndef ___DVB_MPLAYER_H
|
nathan@0
|
23 |
#define ___DVB_MPLAYER_H
|
nathan@0
|
24 |
|
nathan@0
|
25 |
#include <vdr/player.h>
|
nathan@0
|
26 |
#include <vdr/thread.h>
|
nathan@0
|
27 |
#include <vdr/status.h>
|
nathan@0
|
28 |
|
nathan@0
|
29 |
// ----------------------------------------------------------------
|
nathan@0
|
30 |
|
nathan@0
|
31 |
class cFileObj;
|
nathan@0
|
32 |
class cMPlayerResume;
|
nathan@0
|
33 |
|
nathan@0
|
34 |
// ----------------------------------------------------------------
|
nathan@0
|
35 |
|
nathan@0
|
36 |
class cMPlayerStatus : public cStatus, cMutex {
|
nathan@0
|
37 |
private:
|
nathan@0
|
38 |
int volume;
|
nathan@0
|
39 |
bool mute, changed;
|
nathan@0
|
40 |
protected:
|
nathan@0
|
41 |
virtual void SetVolume(int Volume, bool Absolute);
|
nathan@0
|
42 |
public:
|
nathan@0
|
43 |
cMPlayerStatus(void);
|
nathan@0
|
44 |
bool GetVolume(int &Volume, bool &Mute);
|
nathan@0
|
45 |
};
|
nathan@0
|
46 |
|
nathan@0
|
47 |
extern cMPlayerStatus *status;
|
nathan@0
|
48 |
|
nathan@0
|
49 |
// ----------------------------------------------------------------
|
nathan@0
|
50 |
|
nathan@0
|
51 |
class cMPlayerPlayer : public cPlayer, cThread {
|
nathan@0
|
52 |
private:
|
nathan@0
|
53 |
cFileObj *file;
|
nathan@0
|
54 |
bool rewind;
|
nathan@0
|
55 |
cMPlayerResume *resume;
|
nathan@0
|
56 |
bool started, slave, run;
|
nathan@0
|
57 |
int pid, inpipe[2], outpipe[2], pipefl;
|
nathan@0
|
58 |
bool brokenPipe;
|
nathan@0
|
59 |
enum ePlayMode { pmPlay, pmPaused };
|
nathan@0
|
60 |
ePlayMode playMode;
|
nathan@0
|
61 |
int index, total, saveIndex;
|
nathan@0
|
62 |
int nextTime, nextPos;
|
nathan@0
|
63 |
int mpVolume;
|
nathan@0
|
64 |
bool mpMute;
|
nathan@0
|
65 |
char *currentName;
|
nathan@0
|
66 |
//
|
nathan@0
|
67 |
bool Fork(void);
|
nathan@0
|
68 |
void ClosePipe(void);
|
nathan@0
|
69 |
void MPlayerControl(const char *format, ...);
|
nathan@0
|
70 |
void SetMPlayerVolume(bool force);
|
nathan@0
|
71 |
protected:
|
nathan@0
|
72 |
virtual void Activate(bool On);
|
nathan@0
|
73 |
virtual void Action(void);
|
nathan@0
|
74 |
public:
|
nathan@0
|
75 |
cMPlayerPlayer(const cFileObj *File, bool Rewind);
|
nathan@0
|
76 |
virtual ~cMPlayerPlayer();
|
nathan@0
|
77 |
bool Active(void);
|
nathan@0
|
78 |
bool SlaveMode(void) const { return slave; }
|
nathan@0
|
79 |
void Pause(void);
|
nathan@0
|
80 |
void Play(void);
|
nathan@0
|
81 |
void Goto(int Index, bool percent, bool still);
|
nathan@0
|
82 |
void SkipSeconds(int secs);
|
nathan@0
|
83 |
void KeyCmd(const char *cmd);
|
nathan@0
|
84 |
char *GetCurrentName(void);
|
nathan@0
|
85 |
virtual bool GetIndex(int &Current, int &Total, bool SnapToIFrame);
|
nathan@0
|
86 |
virtual bool GetReplayMode(bool &Play, bool &Forward, int &Speed);
|
nathan@0
|
87 |
};
|
nathan@0
|
88 |
|
nathan@0
|
89 |
extern int MPlayerAid;
|
nathan@0
|
90 |
extern const char *globalResumeDir;
|
nathan@0
|
91 |
|
nathan@0
|
92 |
#endif //___DVB_MPLAYER_H
|