diff --git a/HISTORY b/HISTORY index 4ad777f5..c9be86da 100644 --- a/HISTORY +++ b/HISTORY @@ -2118,3 +2118,7 @@ Video Disk Recorder Revision History - Implemented the CableDeliverySystemDescriptor in libdtv (thanks to Sven Grothklags) - Fixed keeping live video active in case the primary device doesn't have an MPEG decoder (thanks to Wolfgang Goeller for reporting this one). +- Implemented cDevice::ActualDevice(), which returns the actual receiving device in + case of 'Transfer Mode', or the primary device otherwise. This may be useful for + plugins that want to attach a cReceiver to the device where the current live video + is actually coming from. diff --git a/PLUGINS.html b/PLUGINS.html index 4a2571c6..bd1a0d0f 100644 --- a/PLUGINS.html +++ b/PLUGINS.html @@ -1200,9 +1200,16 @@ a cDevice:


cMyReceiver *Receiver = new cMyReceiver(123); -cDevice::PrimaryDevice()->AttachReceiver(Receiver); +
  +cDevice::ActualDevice()->AttachReceiver(Receiver); +

+Noteh the use of cDevice::ActualDevice() here, which makes sure that +the receiver is attached to the device that actually receives the current live +video stream (this may be different from the primary device in case of Transfer +Mode). +

If the cReceiver isn't needed any more, it may simply be deleted and will automatically detach itself from the cDevice. diff --git a/device.c b/device.c index 9346d3b5..b248114a 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.41 2003/05/03 13:40:15 kls Exp $ + * $Id: device.c 1.42 2003/05/11 08:53:09 kls Exp $ */ #include "device.h" @@ -130,6 +130,14 @@ cSpuDecoder *cDevice::GetSpuDecoder(void) return NULL; } +cDevice *cDevice::ActualDevice(void) +{ + cDevice *d = cTransferControl::ReceiverDevice(); + if (!d) + d = PrimaryDevice(); + return d; +} + cDevice *cDevice::GetDevice(int Index) { return (0 <= Index && Index < numDevices) ? device[Index] : NULL; diff --git a/device.h b/device.h index d2cc4f83..a41312a2 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.32 2003/05/03 13:35:55 kls Exp $ + * $Id: device.h 1.33 2003/05/11 08:50:04 kls Exp $ */ #ifndef __DEVICE_H @@ -75,6 +75,9 @@ public: ///< \return true if this was possible. static cDevice *PrimaryDevice(void) { return primaryDevice; } ///< Returns the primary device. + static cDevice *ActualDevice(void); + ///< Returns the actual receiving device in case of Transfer Mode, or the + ///< primary device otherwise. static cDevice *GetDevice(int Index); ///< Gets the device with the given Index. ///< \param Index must be in the range 0..numDevices-1. diff --git a/transfer.c b/transfer.c index 9354e58f..cdde5520 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.11 2003/03/30 12:52:11 kls Exp $ + * $Id: transfer.c 1.12 2003/05/11 08:48:05 kls Exp $ */ #include "transfer.h" @@ -179,13 +179,17 @@ void cTransfer::SetAudioTrack(int Index) // --- cTransferControl ------------------------------------------------------ +cDevice *cTransferControl::receiverDevice = NULL; + 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); + receiverDevice = ReceiverDevice; } cTransferControl::~cTransferControl() { + receiverDevice = NULL; delete transfer; } diff --git a/transfer.h b/transfer.h index d94c85ab..5ecb96ad 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.3 2002/10/12 12:59:05 kls Exp $ + * $Id: transfer.h 1.4 2003/05/11 08:48:36 kls Exp $ */ #ifndef __TRANSFER_H @@ -40,10 +40,12 @@ public: class cTransferControl : public cControl { private: cTransfer *transfer; + static cDevice *receiverDevice; public: cTransferControl(cDevice *ReceiverDevice, int VPid, int APid1, int APid2, int DPid1, int DPid2); ~cTransferControl(); virtual void Hide(void) {} + static cDevice *ReceiverDevice(void) { return receiverDevice; } }; #endif //__TRANSFER_H