From 6b229d7d5f6377a930191d9ba469b7707b8eb8a5 Mon Sep 17 00:00:00 2001
From: Klaus Schmidinger <vdr@tvdr.de>
Date: Mon, 12 Jan 2015 14:12:19 +0100
Subject: Added functions to set and retrieve the priority of a cReceiver

---
 CONTRIBUTORS | 1 +
 HISTORY      | 2 ++
 receiver.c   | 9 +++++++--
 receiver.h   | 4 +++-
 4 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index cf961d25..44560335 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -2549,6 +2549,7 @@ Frank Schmirler <vdr@schmirler.de>
  for suggestions used in revising priority handling to allow receivers with a priority
  that is lower than that of live viewing
  for fixing handling IDLEPRIORITY in cDvbDevice::ProvidesChannel()
+ for suggesting to add functions to set and retrieve the priority of a cReceiver
 
 J�rn Reder <joern@zyn.de>
  for reporting that a recording may unnecessarily block a device with a CAM, while
diff --git a/HISTORY b/HISTORY
index 889e6cd4..99cece5d 100644
--- a/HISTORY
+++ b/HISTORY
@@ -8349,3 +8349,5 @@ Video Disk Recorder Revision History
 - Added the functions IndexOf(), InsertUnique(), AppendUnique() and RemoveElement()
   to the cVector class (thanks to Stefan Schallenberg).
 - Fixed a possible out-of-bounds access in cVector::Remove().
+- Added functions to set and retrieve the priority of a cReceiver (suggested by
+  Frank Schmirler).
diff --git a/receiver.c b/receiver.c
index a3811003..d8f51e68 100644
--- a/receiver.c
+++ b/receiver.c
@@ -4,7 +4,7 @@
  * See the main source file 'vdr.c' for copyright information and
  * how to reach the author.
  *
- * $Id: receiver.c 3.2 2014/02/08 15:57:30 kls Exp $
+ * $Id: receiver.c 3.3 2015/01/12 14:04:31 kls Exp $
  */
 
 #include "receiver.h"
@@ -14,7 +14,7 @@
 cReceiver::cReceiver(const cChannel *Channel, int Priority)
 {
   device = NULL;
-  priority = constrain(Priority, MINPRIORITY, MAXPRIORITY);
+  SetPriority(Priority);
   numPids = 0;
   SetPids(Channel);
 }
@@ -29,6 +29,11 @@ cReceiver::~cReceiver()
      }
 }
 
+void cReceiver::SetPriority(int Priority)
+{
+  priority = constrain(Priority, MINPRIORITY, MAXPRIORITY);
+}
+
 bool cReceiver::AddPid(int Pid)
 {
   if (Pid) {
diff --git a/receiver.h b/receiver.h
index 1623f595..b3548258 100644
--- a/receiver.h
+++ b/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 3.2 2015/01/12 10:24:20 kls Exp $
+ * $Id: receiver.h 3.3 2015/01/12 14:03:22 kls Exp $
  */
 
 #ifndef __RECEIVER_H
@@ -49,6 +49,8 @@ public:
                ///< 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();
+  int Priority(void) { return priority; }
+  void SetPriority(int Priority);
   bool AddPid(int Pid);
                ///< Adds the given Pid to the list of PIDs of this receiver.
   bool AddPids(const int *Pids);
-- 
cgit v1.2.3