From a4a2466bf4017f49e5ff729b19088c732531de89 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Fri, 11 Jun 2021 09:38:38 +0200 Subject: Fixed restarting PMT pids after starting a recording on the currently viewed channel --- HISTORY | 5 +++++ pat.c | 26 ++++++++++++++++++++------ pat.h | 3 ++- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/HISTORY b/HISTORY index 4c58eeec..6eff1005 100644 --- a/HISTORY +++ b/HISTORY @@ -9719,3 +9719,8 @@ Video Disk Recorder Revision History - Fixed flushing old data from the section handler (thanks to Helmut Binder). - Removed unused declaration of cDvbTuner::SetFrontendType() (thanks to Helmut Binder). - Fixed handling incomplete multi-packet CAT (thanks to Helmut Binder). + +2021-06-11: + +- Fixed restarting PMT pids after starting a recording on the currently viewed channel + (with help from Helmut Binder). diff --git a/pat.c b/pat.c index 30424866..f58edf55 100644 --- a/pat.c +++ b/pat.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: pat.c 5.2 2021/06/08 14:57:26 kls Exp $ + * $Id: pat.c 5.3 2021/06/11 09:38:38 kls Exp $ */ #include "pat.h" @@ -295,8 +295,7 @@ public: int Pid(void) { return pid; } int Count(void) { return count; } int State(void) { int s = state; state = 0; return s; } // returns the current state and resets it - void SetState(void) { state = 1; } - void ClrState(void) { state = -1; } + void SetState(int State) { state = State; } // 1 = add the PID, -1 = delete the PID, 0 = do nothing void Inc(void) { if (++count == 1) state = 1; } void Dec(void) { if (--count == 0) state = -1; } int Complete(void) { return complete; } @@ -372,6 +371,21 @@ cPatFilter::cPatFilter(void) Set(0x00, 0x00); // PAT } +void cPatFilter::SetStatus(bool On) +{ + cMutexLock MutexLock(&mutex); + if (On) { // restart all requested PMT Pids + for (cPmtPidEntry *pPid = pmtPidList.First(); pPid; pPid = pmtPidList.Next(pPid)) + pPid->SetState(pPid->Count() > 0); + if (activePmt && activePmt->Count() == 0) { + activePmt->SetState(1); + timer.Set(PMT_SCAN_TIMEOUT); + } + } + DBGLOG("PAT filter set status %d", On); + cFilter::SetStatus(On); +} + bool cPatFilter::TransponderChanged(void) { if (source != Source() || transponder != Transponder()) { @@ -389,10 +403,10 @@ void cPatFilter::Trigger(int) DBGLOG("PAT filter trigger"); if (activePmt != pmtPidList.First()) { if (activePmt && activePmt->Count() == 0) - activePmt->ClrState(); + activePmt->SetState(-1); activePmt = pmtPidList.First(); if (activePmt && activePmt->Count() == 0) { - activePmt->SetState(); + activePmt->SetState(1); timer.Set(PMT_SCAN_TIMEOUT); } } @@ -570,7 +584,7 @@ void cPatFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length if (sectionSyncer.Processed(pat.getSectionNumber(), pat.getLastSectionNumber())) { // all PAT sections done for (cPmtPidEntry *pPid = pmtPidList.First(); pPid; pPid = pmtPidList.Next(pPid)) { if (pPid->Count() == 0) { - pPid->SetState(); + pPid->SetState(1); activePmt = pPid; timer.Set(PMT_SCAN_TIMEOUT); break; diff --git a/pat.h b/pat.h index 84f263ea..86999a53 100644 --- a/pat.h +++ b/pat.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: pat.h 5.1 2021/06/08 14:57:26 kls Exp $ + * $Id: pat.h 5.2 2021/06/11 09:38:38 kls Exp $ */ #ifndef __PAT_H @@ -40,6 +40,7 @@ protected: virtual void Process(u_short Pid, u_char Tid, const u_char *Data, int Length); public: cPatFilter(void); + virtual void SetStatus(bool On); void Trigger(int); // triggers reading the PMT PIDs that are currently not requested (dummy parameter for backwards compatibility, value is ignored) void Request(int Sid); // requests permanent reading of the PMT PID for this SID void Release(int Sid); // releases permanent reading of the PMT PID for this SID -- cgit v1.2.3