Home

Dokumentation

Impressum

Dokumentation VDR
 

Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields   Globals  

player.c

Go to the documentation of this file.
00001 /*
00002  * player.c: The basic player interface
00003  *
00004  * See the main source file 'vdr.c' for copyright information and
00005  * how to reach the author.
00006  *
00007  * $Id: player.c 1.6 2002/11/02 14:55:37 kls Exp $
00008  */
00009 
00010 #include "player.h"
00011 #include "i18n.h"
00012 
00013 // --- cPlayer ---------------------------------------------------------------
00014 
00015 cPlayer::cPlayer(ePlayMode PlayMode)
00016 {
00017   device = NULL;
00018   playMode = PlayMode;
00019 }
00020 
00021 cPlayer::~cPlayer()
00022 {
00023   Detach();
00024 }
00025 
00026 int cPlayer::PlayVideo(const uchar *Data, int Length)
00027 {
00028   if (device)
00029      return device->PlayVideo(Data, Length);
00030   esyslog("ERROR: attempt to use cPlayer::PlayVideo() without attaching to a cDevice!");
00031   return -1;
00032 }
00033 
00034 void cPlayer::PlayAudio(const uchar *Data, int Length)
00035 {
00036   if (device) {
00037      device->PlayAudio(Data, Length);
00038      return;
00039      }
00040   esyslog("ERROR: attempt to use cPlayer::PlayAudio() without attaching to a cDevice!");
00041 }
00042 
00043 void cPlayer::Detach(void)
00044 {
00045   if (device)
00046      device->Detach(this);
00047 }
00048 
00049 // --- cControl --------------------------------------------------------------
00050 
00051 cControl *cControl::control = NULL;
00052 
00053 cControl::cControl(cPlayer *Player, bool Hidden)
00054 {
00055   attached = false;
00056   hidden = Hidden;
00057   player = Player;
00058 }
00059 
00060 cControl::~cControl()
00061 {
00062   if (this == control)
00063      control = NULL;
00064 }
00065 
00066 cControl *cControl::Control(void)
00067 {
00068   return (control && !control->hidden) ? control : NULL;
00069 }
00070 
00071 void cControl::Launch(cControl *Control)
00072 {
00073   delete control;
00074   control = Control;
00075 }
00076 
00077 void cControl::Attach(void)
00078 {
00079   if (control && !control->attached && control->player && !control->player->IsAttached()) {
00080      if (cDevice::PrimaryDevice()->AttachPlayer(control->player))
00081         control->attached = true;
00082      else {
00083         Interface->Error(tr("Channel locked (recording)!"));
00084         Shutdown();
00085         }
00086      }
00087 }
00088 
00089 void cControl::Shutdown(void)
00090 {
00091   delete control;
00092   control = NULL;
00093 }

Generated on Wed Feb 5 23:30:10 2003 for VDR by doxygen1.3-rc2