player-mplayer.h
author nathan
Sat, 29 Dec 2007 14:49:09 +0100
branchtrunk
changeset 2 4c1f7b705009
parent 0 474a1293c3c0
child 39 ba6464ebc3f9
permissions -rw-r--r--
release 0.10.1
     1 /*
     2  * MP3/MPlayer plugin to VDR (C++)
     3  *
     4  * (C) 2001-2006 Stefan Huelswitt <s.huelswitt@gmx.de>
     5  *
     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.
    10  *
    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.
    15  *
    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
    20  */
    21 
    22 #ifndef ___DVB_MPLAYER_H
    23 #define ___DVB_MPLAYER_H
    24 
    25 #include <vdr/player.h>
    26 #include <vdr/thread.h>
    27 #include <vdr/status.h>
    28 
    29 // ----------------------------------------------------------------
    30 
    31 class cFileObj;
    32 class cMPlayerResume;
    33 
    34 // ----------------------------------------------------------------
    35 
    36 class cMPlayerStatus : public cStatus, cMutex {
    37 private:
    38   int volume;
    39   bool mute, changed;
    40 protected:
    41   virtual void SetVolume(int Volume, bool Absolute);
    42 public:
    43   cMPlayerStatus(void);
    44   bool GetVolume(int &Volume, bool &Mute);
    45   };
    46 
    47 extern cMPlayerStatus *status;
    48 
    49 // ----------------------------------------------------------------
    50 
    51 class cMPlayerPlayer : public cPlayer, cThread {
    52 private:
    53   cFileObj *file;
    54   bool rewind;
    55   cMPlayerResume *resume;
    56   bool started, slave, run;
    57   int pid, inpipe[2], outpipe[2], pipefl;
    58   bool brokenPipe;
    59   enum ePlayMode { pmPlay, pmPaused };
    60   ePlayMode playMode;
    61   int index, total, saveIndex;
    62   int nextTime, nextPos;
    63   int mpVolume;
    64   bool mpMute;
    65   char *currentName;
    66   //
    67   bool Fork(void);
    68   void ClosePipe(void);
    69   void MPlayerControl(const char *format, ...);
    70   void SetMPlayerVolume(bool force);
    71 protected:
    72   virtual void Activate(bool On);
    73   virtual void Action(void);
    74 public:
    75   cMPlayerPlayer(const cFileObj *File, bool Rewind);
    76   virtual ~cMPlayerPlayer();
    77   bool Active(void);
    78   bool SlaveMode(void) const { return slave; }
    79   void Pause(void);
    80   void Play(void);
    81   void Goto(int Index, bool percent, bool still);
    82   void SkipSeconds(int secs);
    83   void KeyCmd(const char *cmd);
    84   char *GetCurrentName(void);
    85   virtual bool GetIndex(int &Current, int &Total, bool SnapToIFrame);
    86   virtual bool GetReplayMode(bool &Play, bool &Forward, int &Speed);
    87   };
    88 
    89 extern int MPlayerAid;
    90 extern const char *globalResumeDir;
    91 
    92 #endif //___DVB_MPLAYER_H