nathan@0: /* nathan@0: * MP3/MPlayer plugin to VDR (C++) nathan@0: * nathan@0: * (C) 2001-2006 Stefan Huelswitt nathan@0: * nathan@0: * This code is free software; you can redistribute it and/or nathan@0: * modify it under the terms of the GNU General Public License nathan@0: * as published by the Free Software Foundation; either version 2 nathan@0: * of the License, or (at your option) any later version. nathan@0: * nathan@0: * This code is distributed in the hope that it will be useful, nathan@0: * but WITHOUT ANY WARRANTY; without even the implied warranty of nathan@0: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the nathan@0: * GNU General Public License for more details. nathan@0: * nathan@0: * You should have received a copy of the GNU General Public License nathan@0: * along with this program; if not, write to the Free Software nathan@0: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. nathan@0: * Or, point your browser to http://www.gnu.org/copyleft/gpl.html nathan@0: */ nathan@0: nathan@0: #ifndef ___DVB_MPLAYER_H nathan@0: #define ___DVB_MPLAYER_H nathan@0: nathan@0: #include nathan@0: #include nathan@0: #include nathan@0: nathan@0: // ---------------------------------------------------------------- nathan@0: nathan@0: class cFileObj; nathan@0: class cMPlayerResume; nathan@0: nathan@0: // ---------------------------------------------------------------- nathan@0: nathan@0: class cMPlayerStatus : public cStatus, cMutex { nathan@0: private: nathan@0: int volume; nathan@0: bool mute, changed; nathan@0: protected: nathan@0: virtual void SetVolume(int Volume, bool Absolute); nathan@0: public: nathan@0: cMPlayerStatus(void); nathan@0: bool GetVolume(int &Volume, bool &Mute); nathan@0: }; nathan@0: nathan@0: extern cMPlayerStatus *status; nathan@0: nathan@0: // ---------------------------------------------------------------- nathan@0: nathan@0: class cMPlayerPlayer : public cPlayer, cThread { nathan@0: private: nathan@0: cFileObj *file; nathan@0: bool rewind; nathan@0: cMPlayerResume *resume; nathan@0: bool started, slave, run; nathan@0: int pid, inpipe[2], outpipe[2], pipefl; nathan@0: bool brokenPipe; nathan@0: enum ePlayMode { pmPlay, pmPaused }; nathan@0: ePlayMode playMode; nathan@0: int index, total, saveIndex; nathan@0: int nextTime, nextPos; nathan@0: int mpVolume; nathan@0: bool mpMute; nathan@0: char *currentName; nathan@0: // nathan@0: bool Fork(void); nathan@0: void ClosePipe(void); nathan@0: void MPlayerControl(const char *format, ...); nathan@0: void SetMPlayerVolume(bool force); nathan@0: protected: nathan@0: virtual void Activate(bool On); nathan@0: virtual void Action(void); nathan@0: public: nathan@0: cMPlayerPlayer(const cFileObj *File, bool Rewind); nathan@0: virtual ~cMPlayerPlayer(); nathan@0: bool Active(void); nathan@0: bool SlaveMode(void) const { return slave; } nathan@0: void Pause(void); nathan@0: void Play(void); nathan@0: void Goto(int Index, bool percent, bool still); nathan@0: void SkipSeconds(int secs); nathan@0: void KeyCmd(const char *cmd); nathan@0: char *GetCurrentName(void); nathan@0: virtual bool GetIndex(int &Current, int &Total, bool SnapToIFrame); nathan@0: virtual bool GetReplayMode(bool &Play, bool &Forward, int &Speed); nathan@0: }; nathan@0: nathan@0: extern int MPlayerAid; nathan@0: extern const char *globalResumeDir; nathan@0: nathan@0: #endif //___DVB_MPLAYER_H