mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Implemented cDevice::ActualDevice()
This commit is contained in:
parent
823945204c
commit
7a0054abbd
4
HISTORY
4
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.
|
||||
|
@ -1200,9 +1200,16 @@ a <tt>cDevice</tt>:
|
||||
<p><table><tr><td bgcolor=#F0F0F0><pre><br>
|
||||
cMyReceiver *Receiver = new cMyReceiver(123);
|
||||
|
||||
cDevice::PrimaryDevice()->AttachReceiver(Receiver);
|
||||
<!--X1.1.31--><table width=100%><tr><td bgcolor=#FF0000> </td><td width=100%>
|
||||
cDevice::ActualDevice()->AttachReceiver(Receiver);
|
||||
<!--X1.1.31--></td></tr></table>
|
||||
</pre></td></tr></table><p>
|
||||
|
||||
Noteh the use of <tt>cDevice::ActualDevice()</tt> 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 <i>Transfer
|
||||
Mode</i>).
|
||||
<p>
|
||||
If the <tt>cReceiver</tt> isn't needed any more, it may simply be <i>deleted</i>
|
||||
and will automatically detach itself from the <tt>cDevice</tt>.
|
||||
|
||||
|
10
device.c
10
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;
|
||||
|
5
device.h
5
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.
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user