From 26981fd7b148ee943d8032b46f83a7409e02e3be Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 23 Jun 2002 12:59:58 +0200 Subject: [PATCH] Switched handling 'Transfer Mode' to the new cPlayer/cControl structures --- HISTORY | 9 +++++---- device.c | 14 +++++--------- device.h | 4 +--- player.c | 10 ++++++++-- player.h | 7 ++++--- transfer.c | 15 ++++++++++++++- transfer.h | 11 ++++++++++- 7 files changed, 47 insertions(+), 23 deletions(-) diff --git a/HISTORY b/HISTORY index 0842d0f9..f7865cf7 100644 --- a/HISTORY +++ b/HISTORY @@ -724,7 +724,7 @@ Video Disk Recorder Revision History "next timer event at..." messages in that case). - Reduced the default value for MinEventTimeout to 30 minutes. - Fixed detecting manual start in shutdown feature. -- An error message is now displayed in case the Transfer Mode can't be +- An error message is now displayed in case the 'Transfer Mode' can't be started because the necessary DVB card is currently recording (or there is no DVB card that can access this channel). - Fixed toggling channels with the '0' key in case the "Ok" button has been @@ -1108,7 +1108,7 @@ Video Disk Recorder Revision History - The "Left" and "Right" keys are now used to page up and down in text displays (like the EPG descriptions or the results of commands executed from the "Commands" menu). -- Fixed high CPU usage in transfer mode. +- Fixed high CPU usage in 'Transfer Mode'. - Replaced 'killproc' with 'killall' in 'runvdr', since apparently 'killproc' is not available by default on some Linux distributions, whereas 'killall' is. Please check if your system provides 'killall' - if it doesn't, please change @@ -1343,7 +1343,7 @@ Video Disk Recorder Revision History will use the same DVB card. During the time where both timers record the data is simply saved to both files. - The following limitations apply to this version: - + Transfer mode doesn't work yet. + + 'Transfer Mode' doesn't work yet. + The '-a' option (for Dolby Digital audio) doesn't work yet. + Switching between different language tracks doesn't work yet. + Cutting doesn't work yet. @@ -1352,6 +1352,7 @@ Video Disk Recorder Revision History - Added Hungarian language texts (thanks to Istvan Koenigsberger and Guido Josten). - Activated cutting. -- Activated transfer mode. +- Activated 'Transfer Mode'. - Moved handling of the Menu key entirely into vdr.c. - Switched VDR's own player to the new cPlayer/cControl structures. +- Switched handling 'Transfer Mode' to the new cPlayer/cControl structures. diff --git a/device.c b/device.c index d30a1e59..c85cd450 100644 --- a/device.c +++ b/device.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: device.c 1.4 2002/06/23 11:16:21 kls Exp $ + * $Id: device.c 1.5 2002/06/23 12:51:24 kls Exp $ */ #include "device.h" @@ -106,7 +106,6 @@ cDevice::cDevice(int n) currentChannel = 0; frequency = 0; - transfer = NULL; mute = false; volume = Setup.CurrentVolume; @@ -120,7 +119,6 @@ cDevice::cDevice(int n) cDevice::~cDevice() { - delete transfer; delete dvrFileName; delete siProcessor; Detach(player); @@ -459,7 +457,6 @@ bool cDevice::SetPid(int fd, dmxPesType_t PesType, int Pid, dmxOutput_t Output) eSetChannelResult cDevice::SetChannel(int ChannelNumber, int Frequency, char Polarization, int Diseqc, int Srate, int Vpid, int Apid, int Tpid, int Ca, int Pnr) { - DELETENULL(transfer); StopReplay(); cStatus::MsgChannelSwitch(this, 0); @@ -623,11 +620,8 @@ eSetChannelResult cDevice::SetChannel(int ChannelNumber, int Frequency, char Pol if (NeedsTransferMode) { cDevice *CaDevice = GetDevice(Ca, 0); if (CaDevice && !CaDevice->Receiving()) { - if ((Result = CaDevice->SetChannel(ChannelNumber, Frequency, Polarization, Diseqc, Srate, Vpid, Apid, Tpid, Ca, Pnr)) == scrOk) { - transfer = new cTransfer(Vpid, Apid, 0, 0, 0);//XXX+ - AttachPlayer(transfer); - CaDevice->AttachReceiver(transfer); - } + if ((Result = CaDevice->SetChannel(ChannelNumber, Frequency, Polarization, Diseqc, Srate, Vpid, Apid, Tpid, Ca, Pnr)) == scrOk) + cControl::Launch(new cTransferControl(CaDevice, Vpid, Apid, 0, 0, 0));//XXX+ } else Result = scrNoTransfer; @@ -791,6 +785,8 @@ void cDevice::StopReplay(void) { if (player) { Detach(player); + if (IsPrimaryDevice()) + cControl::Shutdown(); /*XXX+ if (IsPrimaryDevice()) { // let's explicitly switch the channel back in case it was in Transfer Mode: diff --git a/device.h b/device.h index 8c68ee0a..6f2a34fd 100644 --- a/device.h +++ b/device.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: device.h 1.2 2002/06/22 13:34:55 kls Exp $ + * $Id: device.h 1.3 2002/06/23 11:50:24 kls Exp $ */ #ifndef __DEVICE_H @@ -33,7 +33,6 @@ enum eSetChannelResult { scrOk, scrNoTransfer, scrFailed }; class cPlayer; class cReceiver; -class cTransfer; class cDevice : cThread { friend class cOsd;//XXX @@ -107,7 +106,6 @@ public: private: int currentChannel; int frequency; - cTransfer *transfer; public: eSetChannelResult SetChannel(int ChannelNumber, int Frequency, char Polarization, int Diseqc, int Srate, int Vpid, int Apid, int Tpid, int Ca, int Pnr); static int CurrentChannel(void) { return primaryDevice ? primaryDevice->currentChannel : 0; } diff --git a/player.c b/player.c index 7b66fae0..ca182dfa 100644 --- a/player.c +++ b/player.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: player.c 1.2 2002/06/23 11:23:17 kls Exp $ + * $Id: player.c 1.3 2002/06/23 12:56:25 kls Exp $ */ #include "player.h" @@ -49,9 +49,10 @@ void cPlayer::Detach(void) cControl *cControl::control = NULL; -cControl::cControl(cPlayer *Player) +cControl::cControl(cPlayer *Player, bool Hidden) { attached = false; + hidden = Hidden; player = Player; } @@ -61,6 +62,11 @@ cControl::~cControl() control = NULL; } +cControl *cControl::Control(void) +{ + return (control && !control->hidden) ? control : NULL; +} + void cControl::Launch(cControl *Control) { delete control; diff --git a/player.h b/player.h index ce0cb441..51265f32 100644 --- a/player.h +++ b/player.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: player.h 1.3 2002/06/23 11:20:23 kls Exp $ + * $Id: player.h 1.4 2002/06/23 12:56:38 kls Exp $ */ #ifndef __PLAYER_H @@ -47,16 +47,17 @@ class cControl : public cOsdObject { private: static cControl *control; bool attached; + bool hidden; protected: cPlayer *player; public: - cControl(cPlayer *Player); + cControl(cPlayer *Player, bool Hidden = false); virtual ~cControl(); virtual void Hide(void) = 0; static void Launch(cControl *Control); static void Attach(void); static void Shutdown(void); - static cControl *Control(void) { return control; } + static cControl *Control(void); }; #endif //__PLAYER_H diff --git a/transfer.c b/transfer.c index 0e0a7083..3b0b6360 100644 --- a/transfer.c +++ b/transfer.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: transfer.c 1.1 2002/06/22 13:39:23 kls Exp $ + * $Id: transfer.c 1.2 2002/06/23 12:56:49 kls Exp $ */ #include "transfer.h" @@ -120,3 +120,16 @@ void cTransfer::SetAudioPid(int APid) remux.SetAudioPid(APid); XXX*/ } + +// --- cTransferControl ------------------------------------------------------ + +cTransferControl::cTransferControl(cDevice *ReceiverDevice, int VPid, int APid1, int APid2, int DPid1, int DPid2) +:cControl(transfer = new cTransfer(VPid, APid1, APid2, DPid1, DPid2), true) +{ + ReceiverDevice->AttachReceiver(transfer); +} + +cTransferControl::~cTransferControl() +{ + delete transfer; +} diff --git a/transfer.h b/transfer.h index 060401f7..567f21ab 100644 --- a/transfer.h +++ b/transfer.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: transfer.h 1.1 2002/06/22 13:38:23 kls Exp $ + * $Id: transfer.h 1.2 2002/06/23 12:26:24 kls Exp $ */ #ifndef __TRANSFER_H @@ -32,4 +32,13 @@ public: void SetAudioPid(int APid); }; +class cTransferControl : public cControl { +private: + cTransfer *transfer; +public: + cTransferControl(cDevice *ReceiverDevice, int VPid, int APid1, int APid2, int DPid1, int DPid2); + ~cTransferControl(); + virtual void Hide(void) {} + }; + #endif //__TRANSFER_H