Doug disable the patch to tune ATSC channels by looking at both the major and minor portions of the channel number. This was the correct thing to do, since it was broken. As he pointed out, that code was looking at the Frequency ID instead of the Channel number to determine the "major" portion of the channel number.


This patch fixes the problem for me, by using the "Channel Number" as seen when you run setup. This could be a problem, however, if someone has overridden that value with something other than the "real" channel number. To handle this, it will make a second pass looking for *only* the subchannel, if the majorchannel.subchannel was not found.

John



Index: libs/libmythtv/hdtvrecorder.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/hdtvrecorder.cpp,v
retrieving revision 1.37
diff -d -u -r1.37 hdtvrecorder.cpp
--- libs/libmythtv/hdtvrecorder.cpp	28 Jan 2005 19:51:21 -0000	1.37
+++ libs/libmythtv/hdtvrecorder.cpp	9 Feb 2005 07:29:25 -0000
@@ -921,7 +921,7 @@
     int pos = freqid.find('-');
     if (pos != -1) 
     {
-        desired_channel = -1;
+        desired_channel = atoi(curChannelName);
         desired_subchannel = atoi(freqid.mid(pos+1).ascii());
     }
     else
Index: libs/libmythtv/mpeg/atscstreamdata.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/mpeg/atscstreamdata.cpp,v
retrieving revision 1.4
diff -d -u -r1.4 atscstreamdata.cpp
--- libs/libmythtv/mpeg/atscstreamdata.cpp	21 Jan 2005 06:55:16 -0000	1.4
+++ libs/libmythtv/mpeg/atscstreamdata.cpp	9 Feb 2005 07:29:25 -0000
@@ -56,6 +56,8 @@
 
 void ATSCStreamData::HandleTables(const TSPacket* tspacket, HDTVRecorder* recorder)
 {
+    uint  idx;
+
 #define HT_RETURN { delete psip; return; }
     PSIPTable *psip = AssemblePSIP(tspacket);
     if (!psip)
@@ -128,32 +130,67 @@
 
             bool found = false;
 
-            for (uint i=0; i<vct.ChannelCount(); i++) {
-                VERBOSE(VB_RECORD, vct.toString(i));
+            for (idx=0; idx<vct.ChannelCount(); idx++) {
+                VERBOSE(VB_RECORD, vct.toString(idx));
                 if ((DesiredChannel() == -1 ||
-                    vct.MajorChannel(i)==(uint)DesiredChannel()) &&  
-                    vct.MinorChannel(i)==(uint)DesiredSubchannel()) {
-                    VERBOSE(VB_RECORD, QString("***Desired subchannel %1")
+                    vct.MajorChannel(idx)==(uint)DesiredChannel()) &&  
+                    vct.MinorChannel(idx)==(uint)DesiredSubchannel())
+                {
+                    VERBOSE(VB_RECORD, QString("***Desired channel %1 . %2")
+                            .arg(DesiredChannel())
                             .arg(DesiredSubchannel()));
-                    if (vct.ProgramNumber(i) != (uint)DesiredProgram()) {
+                    VERBOSE(VB_RECORD, QString("***Found %1 . %2")
+                            .arg(vct.MajorChannel(idx))
+                            .arg(vct.MinorChannel(idx)));
+
+                    if (vct.ProgramNumber(idx) != (uint)DesiredProgram()) {
                         VERBOSE(VB_RECORD, 
                                 QString("Resetting desired program from %1"
                                         " to %2").arg(DesiredProgram())
-                                .arg(vct.ProgramNumber(i)));
+                                .arg(vct.ProgramNumber(idx)));
                         // Do a (partial?) reset here if old desired
                         // program is not 0?
-                        setDesiredProgram(vct.ProgramNumber(i));
+                        setDesiredProgram(vct.ProgramNumber(idx));
                         found = true;
                     }
                 }
             }
+            
+            if (!found)
+            {
+                VERBOSE(VB_RECORD, QString("Desired channel %1 . %2 "
+                                           "not found.  Ignoring %1")
+                        .arg(vct.MajorChannel(idx))
+                        .arg(vct.MinorChannel(idx)));
+                for (idx=0; idx<vct.ChannelCount(); idx++) {
+                    VERBOSE(VB_RECORD, vct.toString(idx));
+                    if (vct.MinorChannel(idx)==(uint)DesiredSubchannel()) {
+                        VERBOSE(VB_RECORD, QString("***Desired subchannel %1")
+                                .arg(DesiredSubchannel()));
+                        VERBOSE(VB_RECORD, QString("***Found %1 . %2")
+                                .arg(vct.MajorChannel(idx))
+                                .arg(vct.MinorChannel(idx)));
+                        if (vct.ProgramNumber(idx) != (uint)DesiredProgram()) {
+                            VERBOSE(VB_RECORD, 
+                                    QString("Resetting desired program from %1"
+                                            " to %2").arg(DesiredProgram())
+                                    .arg(vct.ProgramNumber(idx)));
+                            // Do a (partial?) reset here if old desired
+                            // program is not 0?
+                            setDesiredProgram(vct.ProgramNumber(idx));
+                            found = true;
+                        }
+                    }
+                }
 
-            if (!found) {
-                VERBOSE(VB_IMPORTANT, 
-                        QString("Desired subchannel %1 not found;"
-                                " using %2 instead")
-                        .arg(DesiredSubchannel()).arg(vct.MinorChannel(0)));
-                setDesiredProgram(vct.ProgramNumber(0));
+                if (!found)
+                {
+                    VERBOSE(VB_IMPORTANT, 
+                            QString("Desired subchannel %1 not found;"
+                                    " using %2 instead")
+                            .arg(DesiredSubchannel()).arg(vct.MinorChannel(0)));
+                    setDesiredProgram(vct.ProgramNumber(0));
+                }
             }
         }
         break;
_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev

Reply via email to