[mythtv] [patch] badsignal/tuning-failure handling patch.

Daniel Thor Kristjansson danielk at mrl.nyu.edu
Thu Oct 21 15:50:24 UTC 2004


This patch checks the value of IsErrored() from the recorder in tv_rec 
and fires a QUIT_LIVETV event if there is an error. Also, in addition 
to responding to the QUIT_LIVETV event, tv_play now starts the 
recorder first, and then only start the player if the recorder 
successfully starts.

This patch will work much better if you apply the 'recorder open' patch 
which fixes IsErrored() handling in most of the recorders.

Also, if you apply these last two patches, and you want to use the rest 
of the hdtv-recorder patch, please use version 27:
   http://www.mrl.nyu.edu/~danielk/mythtv/hdtv-recorder-v27.tbz

-- Daniel
-------------- next part --------------
Index: libs/libmythtv/tv_play.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/tv_play.cpp,v
retrieving revision 1.213
diff -u -r1.213 tv_play.cpp
--- libs/libmythtv/tv_play.cpp	13 Oct 2004 01:49:55 -0000	1.213
+++ libs/libmythtv/tv_play.cpp	21 Oct 2004 15:01:29 -0000
@@ -658,7 +658,18 @@
         recorder->SpawnLiveTV();
 
         gContext->DisableScreensaver();
-        StartPlayerAndRecorder(true, true);
+        StartPlayerAndRecorder(true, false);
+        if (recorder->IsRecording())
+            StartPlayerAndRecorder(false, true);
+        else
+        {
+            VERBOSE(VB_IMPORTANT, "LiveTV not successfully started");
+            tmpInternalState = internalState;
+            nextState = internalState;
+            StopPlayerAndRecorder(true, false);
+            gContext->RestoreScreensaver();
+            recorder = NULL;
+        }
     }
     else if (internalState == kState_WatchingLiveTV && 
              nextState == kState_None)
@@ -788,9 +799,10 @@
 { 
     if (startRecorder)
     {
-        while (!recorder->IsRecording())
+        while (!recorder->IsRecording() && !exitPlayer)
             usleep(50);
-
+        if (exitPlayer)
+            return;
         frameRate = recorder->GetFrameRate();
     }
 
@@ -3349,8 +3361,7 @@
                 AskAllowRecording(me->ExtraDataList(), timeuntil);
             }
         }
-        else if (GetState() == kState_WatchingLiveTV &&
-                 message.left(11) == "QUIT_LIVETV")
+        else if (message.left(11) == "QUIT_LIVETV")
         {
             message = message.simplifyWhiteSpace();
             QStringList tokens = QStringList::split(" ", message);
Index: libs/libmythtv/tv_rec.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/tv_rec.cpp,v
retrieving revision 1.164
diff -u -r1.164 tv_rec.cpp
--- libs/libmythtv/tv_rec.cpp	13 Oct 2004 01:49:55 -0000	1.164
+++ libs/libmythtv/tv_rec.cpp	21 Oct 2004 15:01:29 -0000
@@ -554,8 +554,15 @@
         }
         else
         {
-            if (nvr->IsErrored())
+            if (error || nvr->IsErrored()) {
+                VERBOSE(VB_IMPORTANT, "TVRec: Recording Prematurely Stopped");
+
+                QString message = QString("QUIT_LIVETV %1").arg(m_capturecardnum);
+                MythEvent me(message);
+                gContext->dispatch(me);
+
                 prematurelystopped = true;
+            }
             FinishedRecording();
             killRecordingFile = true;
             closeRecorder = true;


More information about the mythtv-dev mailing list