mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Revised priority handling to allow receivers with a priority that is lower than that of live viewing
This commit is contained in:
parent
a188928e6e
commit
28bc34b245
@ -2405,6 +2405,8 @@ Frank Schmirler <vdr@schmirler.de>
|
||||
recordings of the same broadcast made by different instances of VDR
|
||||
for fixing EntriesOnSameFileSystem() to avoid using f_fsid, which may be 0
|
||||
for fixing the German translation of "Folder name must not contain '%c'!"
|
||||
for suggestions used in revising priority handling to allow receivers with a priority
|
||||
that is lower than that of live viewing
|
||||
|
||||
Jörn Reder <joern@zyn.de>
|
||||
for reporting that a recording may unnecessarily block a device with a CAM, while
|
||||
|
14
HISTORY
14
HISTORY
@ -6889,7 +6889,7 @@ Video Disk Recorder Revision History
|
||||
- Fixed switching into time shift mode when pausing live video (thanks to Reinhard
|
||||
Nissl for helping to debug this one).
|
||||
|
||||
2012-02-27: Version 1.7.25
|
||||
2012-03-02: Version 1.7.25
|
||||
|
||||
- The fps value for channels where it differs from the default is now set correctly
|
||||
when pausing live video.
|
||||
@ -6932,3 +6932,15 @@ Video Disk Recorder Revision History
|
||||
used --rcu with a device path, use -P"rcu -d<device>".
|
||||
- Added support for automatically selecting subtitles when playing old PES
|
||||
recordings made with the subtitles plugin (thanks to Anssi Hannula).
|
||||
- Revised priority handling to allow receivers with a priority that is lower than
|
||||
that of live viewing (with suggestions from Frank Schmirler):
|
||||
+ An idle device (one that is not used for live viewing and has no receiver
|
||||
attached to it) now has priority IDLEPRIORITY (-100).
|
||||
+ An unused CAM slot now has priority IDLEPRIORITY.
|
||||
+ The default priority of a cReceiver is now MINPRIORITY (-99).
|
||||
+ A device that is used only for live viewing (no matter whether it's in Transfer
|
||||
Mode or real live mode) now has priority TRANSFERPRIORITY (-1).
|
||||
+ The function cDevice::Receiving() now returns true if there is any receiver
|
||||
attached to the device. Its boolean parameter has no meaning any more.
|
||||
+ The default value for the Priority parameter of the function cDevice::ProvidesChannel()
|
||||
has been changed to IDLEPRIORITY.
|
||||
|
@ -1509,7 +1509,10 @@ member functions of <tt>cReceiver</tt>.
|
||||
The above example sets up a receiver that wants to receive data from only one
|
||||
PID (for example the Teletext PID). In order to not interfere with other recording
|
||||
operations, it sets its priority to <tt>-1</tt> (any negative value will allow
|
||||
a <tt>cReceiver</tt> to be detached from its <tt>cDevice</tt> at any time.
|
||||
a <tt>cReceiver</tt> to be detached from its <tt>cDevice</tt> at any time
|
||||
<div class="modified">
|
||||
in favor of a timer recording or live viewing).
|
||||
</div modified>
|
||||
<p>
|
||||
Once a <tt>cReceiver</tt> has been created, it needs to be <i>attached</i> to
|
||||
a <tt>cDevice</tt>:
|
||||
|
4
ci.c
4
ci.c
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: ci.c 2.7 2011/05/21 15:21:33 kls Exp $
|
||||
* $Id: ci.c 2.8 2012/02/29 10:24:41 kls Exp $
|
||||
*/
|
||||
|
||||
#include "ci.h"
|
||||
@ -1841,7 +1841,7 @@ const int *cCamSlot::GetCaSystemIds(void)
|
||||
int cCamSlot::Priority(void)
|
||||
{
|
||||
cDevice *d = Device();
|
||||
return d ? d->Priority() : -1;
|
||||
return d ? d->Priority() : IDLEPRIORITY;
|
||||
}
|
||||
|
||||
bool cCamSlot::ProvidesCa(const int *CaSystemIds)
|
||||
|
4
ci.h
4
ci.h
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: ci.h 2.1 2011/12/04 13:38:17 kls Exp $
|
||||
* $Id: ci.h 2.2 2012/02/29 10:24:27 kls Exp $
|
||||
*/
|
||||
|
||||
#ifndef __CI_H
|
||||
@ -192,7 +192,7 @@ public:
|
||||
///< Gets a pending enquiry, or NULL if there is no enquiry.
|
||||
int Priority(void);
|
||||
///< Returns the priority if the device this slot is currently assigned
|
||||
///< to, or -1 if it is not assigned to any device.
|
||||
///< to, or IDLEPRIORITY if it is not assigned to any device.
|
||||
bool ProvidesCa(const int *CaSystemIds);
|
||||
///< Returns true if the CAM in this slot provides one of the given
|
||||
///< CaSystemIds. This doesn't necessarily mean that it will be
|
||||
|
4
config.c
4
config.c
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: config.c 2.19 2012/02/25 13:31:46 kls Exp $
|
||||
* $Id: config.c 2.20 2012/02/29 10:15:54 kls Exp $
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
@ -407,7 +407,7 @@ cSetup::cSetup(void)
|
||||
ZapTimeout = 3;
|
||||
ChannelEntryTimeout = 1000;
|
||||
DefaultPriority = 50;
|
||||
DefaultLifetime = 99;
|
||||
DefaultLifetime = MAXLIFETIME;
|
||||
PauseKeyHandling = 2;
|
||||
PausePriority = 10;
|
||||
PauseLifetime = 1;
|
||||
|
10
config.h
10
config.h
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: config.h 2.42 2012/02/25 13:31:34 kls Exp $
|
||||
* $Id: config.h 2.43 2012/02/29 12:28:01 kls Exp $
|
||||
*/
|
||||
|
||||
#ifndef __CONFIG_H
|
||||
@ -36,8 +36,12 @@
|
||||
// plugins to work with newer versions of the core VDR as long as no
|
||||
// VDR header files have changed.
|
||||
|
||||
#define MAXPRIORITY 99
|
||||
#define MAXLIFETIME 99
|
||||
#define MAXPRIORITY 99
|
||||
#define MINPRIORITY (-MAXPRIORITY)
|
||||
#define LIVEPRIORITY 0 // priority used when selecting a device for live viewing
|
||||
#define TRANSFERPRIORITY (LIVEPRIORITY - 1) // priority used for actual local Transfer Mode
|
||||
#define IDLEPRIORITY (MINPRIORITY - 1) // priority of an idle device
|
||||
#define MAXLIFETIME 99
|
||||
|
||||
#define MINOSDWIDTH 480
|
||||
#define MAXOSDWIDTH 1920
|
||||
|
14
device.c
14
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 2.51 2012/02/28 09:25:57 kls Exp $
|
||||
* $Id: device.c 2.52 2012/03/02 10:18:44 kls Exp $
|
||||
*/
|
||||
|
||||
#include "device.h"
|
||||
@ -281,8 +281,8 @@ cDevice *cDevice::GetDevice(const cChannel *Channel, int Priority, bool LiveView
|
||||
imp <<= 1; imp |= device[i]->Receiving(); // avoid devices that are receiving
|
||||
imp <<= 4; imp |= GetClippedNumProvidedSystems(4, device[i]) - 1; // avoid cards which support multiple delivery systems
|
||||
imp <<= 1; imp |= device[i] == cTransferControl::ReceiverDevice(); // avoid the Transfer Mode receiver device
|
||||
imp <<= 8; imp |= min(max(device[i]->Priority() + MAXPRIORITY, 0), 0xFF); // use the device with the lowest priority (+MAXPRIORITY to assure that values -99..99 can be used)
|
||||
imp <<= 8; imp |= min(max((NumUsableSlots ? SlotPriority[j] : 0) + MAXPRIORITY, 0), 0xFF); // use the CAM slot with the lowest priority (+MAXPRIORITY to assure that values -99..99 can be used)
|
||||
imp <<= 8; imp |= device[i]->Priority() - IDLEPRIORITY; // use the device with the lowest priority (- IDLEPRIORITY to assure that values -100..99 can be used)
|
||||
imp <<= 8; imp |= (NumUsableSlots ? SlotPriority[j] : IDLEPRIORITY) - IDLEPRIORITY; // use the CAM slot with the lowest priority (- IDLEPRIORITY to assure that values -100..99 can be used)
|
||||
imp <<= 1; imp |= ndr; // avoid devices if we need to detach existing receivers
|
||||
imp <<= 1; imp |= NumUsableSlots ? 0 : device[i]->HasCi(); // avoid cards with Common Interface for FTA channels
|
||||
imp <<= 1; imp |= device[i]->AvoidRecording(); // avoid SD full featured cards
|
||||
@ -652,7 +652,7 @@ bool cDevice::IsTunedToTransponder(const cChannel *Channel) const
|
||||
|
||||
bool cDevice::MaySwitchTransponder(const cChannel *Channel) const
|
||||
{
|
||||
return time(NULL) > occupiedTimeout && !Receiving(true) && !(pidHandles[ptAudio].pid || pidHandles[ptVideo].pid || pidHandles[ptDolby].pid);
|
||||
return time(NULL) > occupiedTimeout && !Receiving() && !(pidHandles[ptAudio].pid || pidHandles[ptVideo].pid || pidHandles[ptDolby].pid);
|
||||
}
|
||||
|
||||
bool cDevice::SwitchChannel(const cChannel *Channel, bool LiveView)
|
||||
@ -1494,6 +1494,8 @@ int cDevice::PlayTs(const uchar *Data, int Length, bool VideoOnly)
|
||||
int cDevice::Priority(void) const
|
||||
{
|
||||
int priority = IDLEPRIORITY;
|
||||
if (IsPrimaryDevice() && !Replaying() && ActualDevice() == PrimaryDevice())
|
||||
priority = TRANSFERPRIORITY; // we use the same value here, no matter whether it's actual Transfer Mode or real live viewing
|
||||
cMutexLock MutexLock(&mutexReceiver);
|
||||
for (int i = 0; i < MAXRECEIVERS; i++) {
|
||||
if (receiver[i])
|
||||
@ -1507,11 +1509,11 @@ bool cDevice::Ready(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cDevice::Receiving(bool CheckAny) const
|
||||
bool cDevice::Receiving(bool Dummy) const
|
||||
{
|
||||
cMutexLock MutexLock(&mutexReceiver);
|
||||
for (int i = 0; i < MAXRECEIVERS; i++) {
|
||||
if (receiver[i] && (CheckAny || receiver[i]->priority >= 0)) // cReceiver with priority < 0 doesn't count
|
||||
if (receiver[i])
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
12
device.h
12
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 2.34 2012/02/25 12:54:39 kls Exp $
|
||||
* $Id: device.h 2.35 2012/02/29 12:19:28 kls Exp $
|
||||
*/
|
||||
|
||||
#ifndef __DEVICE_H
|
||||
@ -31,8 +31,6 @@
|
||||
#define MAXVOLUME 255
|
||||
#define VOLUMEDELTA 5 // used to increase/decrease the volume
|
||||
#define MAXOCCUPIEDTIMEOUT 99 // max. time (in seconds) a device may be occupied
|
||||
#define LIVEPRIORITY 0 // priority used when selecting a device for live viewing
|
||||
#define IDLEPRIORITY (-MAXPRIORITY - 1)
|
||||
|
||||
enum eSetChannelResult { scrOk, scrNotAvailable, scrNoTransfer, scrFailed };
|
||||
|
||||
@ -237,11 +235,11 @@ public:
|
||||
virtual bool ProvidesTransponderExclusively(const cChannel *Channel) const;
|
||||
///< Returns true if this is the only device that is able to provide
|
||||
///< the given channel's transponder.
|
||||
virtual bool ProvidesChannel(const cChannel *Channel, int Priority = -1, bool *NeedsDetachReceivers = NULL) const;
|
||||
virtual bool ProvidesChannel(const cChannel *Channel, int Priority = IDLEPRIORITY, bool *NeedsDetachReceivers = NULL) const;
|
||||
///< Returns true if this device can provide the given channel.
|
||||
///< In case the device has cReceivers attached to it, Priority is used to
|
||||
///< decide whether the caller's request can be honored.
|
||||
///< The special Priority value -1 will tell the caller whether this device
|
||||
///< The special Priority value IDLEPRIORITY will tell the caller whether this device
|
||||
///< is principally able to provide the given Channel, regardless of any
|
||||
///< attached cReceivers.
|
||||
///< If NeedsDetachReceivers is given, the resulting value in it will tell the
|
||||
@ -736,8 +734,8 @@ protected:
|
||||
///< false in case of a non recoverable error, otherwise it returns true,
|
||||
///< even if Data is NULL.
|
||||
public:
|
||||
bool Receiving(bool CheckAny = false) const;
|
||||
///< Returns true if we are currently receiving.
|
||||
bool Receiving(bool Dummy = false) const;
|
||||
///< Returns true if we are currently receiving. The parameter has no meaning (for backwards compatibility only).
|
||||
bool AttachReceiver(cReceiver *Receiver);
|
||||
///< Attaches the given receiver to this device.
|
||||
void Detach(cReceiver *Receiver);
|
||||
|
12
dvbdevice.c
12
dvbdevice.c
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: dvbdevice.c 2.64 2012/02/25 12:10:12 kls Exp $
|
||||
* $Id: dvbdevice.c 2.65 2012/02/29 12:23:43 kls Exp $
|
||||
*/
|
||||
|
||||
#include "dvbdevice.h"
|
||||
@ -420,7 +420,7 @@ bool cDvbTuner::BondingOk(const cChannel *Channel, bool ConsiderOccupied) const
|
||||
if (cDvbTuner *t = bondedTuner) {
|
||||
cString BondingParams = GetBondingParams(Channel);
|
||||
do {
|
||||
if (t->device->Receiving() || t->tunerStatus != tsIdle && (t->device == cDevice::ActualDevice() || ConsiderOccupied && t->device->Occupied())) {
|
||||
if (t->device->Receiving() || ConsiderOccupied && t->device->Occupied()) {
|
||||
if (strcmp(BondingParams, t->GetBondingParams()) != 0)
|
||||
return false;
|
||||
}
|
||||
@ -1437,14 +1437,14 @@ bool cDvbDevice::ProvidesTransponder(const cChannel *Channel) const
|
||||
bool cDvbDevice::ProvidesChannel(const cChannel *Channel, int Priority, bool *NeedsDetachReceivers) const
|
||||
{
|
||||
bool result = false;
|
||||
bool hasPriority = Priority < 0 || Priority > this->Priority();
|
||||
bool hasPriority = Priority == IDLEPRIORITY || Priority > this->Priority();
|
||||
bool needsDetachReceivers = false;
|
||||
needsDetachBondedReceivers = false;
|
||||
|
||||
if (dvbTuner && ProvidesTransponder(Channel)) {
|
||||
result = hasPriority;
|
||||
if (Priority >= 0) {
|
||||
if (Receiving(true)) {
|
||||
if (Receiving()) {
|
||||
if (dvbTuner->IsTunedTo(Channel)) {
|
||||
if (Channel->Vpid() && !HasPid(Channel->Vpid()) || Channel->Apid(0) && !HasPid(Channel->Apid(0))) {
|
||||
if (CamSlot() && Channel->Ca() >= CA_ENCRYPTED_MIN) {
|
||||
@ -1460,7 +1460,7 @@ bool cDvbDevice::ProvidesChannel(const cChannel *Channel, int Priority, bool *Ne
|
||||
result = true;
|
||||
}
|
||||
else
|
||||
needsDetachReceivers = Receiving(true);
|
||||
needsDetachReceivers = Receiving();
|
||||
}
|
||||
if (result) {
|
||||
if (!BondingOk(Channel)) {
|
||||
@ -1472,7 +1472,7 @@ bool cDvbDevice::ProvidesChannel(const cChannel *Channel, int Priority, bool *Ne
|
||||
}
|
||||
}
|
||||
needsDetachBondedReceivers = true;
|
||||
needsDetachReceivers = Receiving(true);
|
||||
needsDetachReceivers = Receiving();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: dvbdevice.h 2.23 2012/02/17 11:18:55 kls Exp $
|
||||
* $Id: dvbdevice.h 2.24 2012/02/29 12:20:51 kls Exp $
|
||||
*/
|
||||
|
||||
#ifndef __DVBDEVICE_H
|
||||
@ -179,7 +179,7 @@ public:
|
||||
virtual bool ProvidesDeliverySystem(int DeliverySystem) const;
|
||||
virtual bool ProvidesSource(int Source) const;
|
||||
virtual bool ProvidesTransponder(const cChannel *Channel) const;
|
||||
virtual bool ProvidesChannel(const cChannel *Channel, int Priority = -1, bool *NeedsDetachReceivers = NULL) const;
|
||||
virtual bool ProvidesChannel(const cChannel *Channel, int Priority = IDLEPRIORITY, bool *NeedsDetachReceivers = NULL) const;
|
||||
virtual bool ProvidesEIT(void) const;
|
||||
virtual int NumProvidedSystems(void) const;
|
||||
virtual int SignalStrength(void) const;
|
||||
|
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: receiver.c 2.4 2010/12/12 23:16:25 kls Exp $
|
||||
* $Id: receiver.c 2.5 2012/02/29 11:49:36 kls Exp $
|
||||
*/
|
||||
|
||||
#include "receiver.h"
|
||||
@ -16,7 +16,7 @@ cReceiver::cReceiver(tChannelID ChannelID, int Priority, int Pid, const int *Pid
|
||||
{
|
||||
device = NULL;
|
||||
channelID = ChannelID;
|
||||
priority = Priority;
|
||||
priority = constrain(Priority, MINPRIORITY, MAXPRIORITY);
|
||||
numPids = 0;
|
||||
AddPid(Pid);
|
||||
AddPids(Pids1);
|
||||
@ -28,7 +28,7 @@ cReceiver::cReceiver(tChannelID ChannelID, int Priority, int Pid, const int *Pid
|
||||
cReceiver::cReceiver(const cChannel *Channel, int Priority)
|
||||
{
|
||||
device = NULL;
|
||||
priority = Priority;
|
||||
priority = constrain(Priority, MINPRIORITY, MAXPRIORITY);
|
||||
numPids = 0;
|
||||
SetPids(Channel);
|
||||
}
|
||||
|
10
receiver.h
10
receiver.h
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: receiver.h 2.4 2012/02/25 12:49:31 kls Exp $
|
||||
* $Id: receiver.h 2.5 2012/03/01 09:50:24 kls Exp $
|
||||
*/
|
||||
|
||||
#ifndef __RECEIVER_H
|
||||
@ -43,15 +43,15 @@ public:
|
||||
#ifdef LEGACY_CRECEIVER
|
||||
cReceiver(tChannelID ChannelID, int Priority, int Pid, const int *Pids1 = NULL, const int *Pids2 = NULL, const int *Pids3 = NULL);
|
||||
#endif
|
||||
cReceiver(const cChannel *Channel = NULL, int Priority = -1);
|
||||
cReceiver(const cChannel *Channel = NULL, int Priority = MINPRIORITY);
|
||||
///< Creates a new receiver for the given Channel with the given Priority.
|
||||
///< If Channel is not NULL, its pids are set by a call to SetPids().
|
||||
///< Otherwise pids can be added to the receiver by separate calls to the AddPid[s]
|
||||
///< functions.
|
||||
///< The total number of PIDs added to a receiver must not exceed MAXRECEIVEPIDS.
|
||||
///< Priority may be any value in the range +/-MAXPRIORITY. Negative values indicate
|
||||
///< that this cReceiver may be detached at any time (without blocking the
|
||||
///< cDevice it is attached to).
|
||||
///< Priority may be any value in the range MINPRIORITY...MAXPRIORITY. Negative values indicate
|
||||
///< that this cReceiver may be detached at any time in favor of a timer recording
|
||||
///< or live viewing (without blocking the cDevice it is attached to).
|
||||
virtual ~cReceiver();
|
||||
bool AddPid(int Pid);
|
||||
///< Adds the given Pid to the list of PIDs of this receiver.
|
||||
|
4
tools.h
4
tools.h
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: tools.h 2.15 2012/02/18 15:29:50 kls Exp $
|
||||
* $Id: tools.h 2.16 2012/02/29 10:41:00 kls Exp $
|
||||
*/
|
||||
|
||||
#ifndef __TOOLS_H
|
||||
@ -57,6 +57,8 @@ template<class T> inline int sgn(T a) { return a < 0 ? -1 : a > 0 ? 1 : 0; }
|
||||
template<class T> inline void swap(T &a, T &b) { T t = a; a = b; b = t; }
|
||||
#endif
|
||||
|
||||
template<class T> inline T constrain(T v, T l, T h) { return v < l ? l : v > h ? h : v; }
|
||||
|
||||
void syslog_with_tid(int priority, const char *format, ...) __attribute__ ((format (printf, 2, 3)));
|
||||
|
||||
#define BCDCHARTOINT(x) (10 * ((x & 0xF0) >> 4) + (x & 0xF))
|
||||
|
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: transfer.c 2.5 2010/01/30 11:10:25 kls Exp $
|
||||
* $Id: transfer.c 2.6 2012/02/29 14:16:23 kls Exp $
|
||||
*/
|
||||
|
||||
#include "transfer.h"
|
||||
@ -12,7 +12,7 @@
|
||||
// --- cTransfer -------------------------------------------------------------
|
||||
|
||||
cTransfer::cTransfer(const cChannel *Channel)
|
||||
:cReceiver(Channel)
|
||||
:cReceiver(Channel, TRANSFERPRIORITY)
|
||||
{
|
||||
patPmtGenerator.SetChannel(Channel);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user