Ticket #3326: 3326-inputgroupbug-v1.patch
File 3326-inputgroupbug-v1.patch, 9.8 KB (added by , 16 years ago) |
---|
-
libs/libmythtv/libmythtv.pro
347 347 # Channel stuff 348 348 HEADERS += channelbase.h dtvchannel.h 349 349 HEADERS += signalmonitor.h dtvsignalmonitor.h 350 HEADERS += inputinfo.h 350 HEADERS += inputinfo.h inputgroupmap.h 351 351 SOURCES += channelbase.cpp dtvchannel.h 352 352 SOURCES += signalmonitor.cpp dtvsignalmonitor.cpp 353 SOURCES += inputinfo.cpp 353 SOURCES += inputinfo.cpp inputgroupmap.cpp 354 354 355 355 # Channel scanner stuff 356 356 HEADERS += scanwizard.h scanwizardhelpers.h -
libs/libmythtv/tv_rec.cpp
574 574 TunedInputInfo busy_input; 575 575 bool is_busy = RemoteIsBusy(cardids[i], busy_input); 576 576 577 // if the other recorder is busy, but the input is 578 // not in a shared input group, then as far as we're 579 // concerned here it isn't busy. 580 if (is_busy) 581 { 582 is_busy = (bool) igrp.GetSharedInputGroup( 583 busy_input.inputid, rcinfo->inputid); 584 } 585 577 586 if (is_busy && !mplexid) 578 587 { 579 588 mplexid = (*it).info->GetMplexID(); -
libs/libmythtv/inputgroupmap.cpp
1 // -*- Mode: c++ -*- 2 /* 3 * Copyright (c) Daniel Kristjansson 2007 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 */ 19 20 #include "inputgroupmap.h" 21 #include "mythdbcon.h" 22 23 bool InputGroupMap::Build(void) 24 { 25 bool ok = true; 26 inputgroupmap.clear(); 27 MSqlQuery query(MSqlQuery::InitCon()); 28 29 query.prepare("SELECT cardinputid, inputgroupid from inputgroup"); 30 if (!query.exec()) 31 { 32 MythContext::DBError("InputGroupMap::Build 1", query); 33 ok = false; 34 } 35 else 36 { 37 while (query.next()) 38 { 39 uint inputid = query.value(0).toUInt(); 40 uint groupid = query.value(1).toUInt(); 41 inputgroupmap[inputid].push_back(groupid); 42 } 43 } 44 45 query.prepare("SELECT cardinputid, cardid from cardinput"); 46 if (!query.exec()) 47 { 48 MythContext::DBError("InputGroupMap::Build 2", query); 49 ok = false; 50 } 51 else 52 { 53 while (query.next()) 54 { 55 uint inputid = query.value(0).toUInt(); 56 uint groupid = query.value(1).toUInt() + 1000; 57 if (inputgroupmap[inputid].empty()) 58 inputgroupmap[inputid].push_back(groupid); 59 } 60 } 61 62 return ok; 63 } 64 65 uint InputGroupMap::GetSharedInputGroup(uint inputid1, uint inputid2) const 66 { 67 const InputGroupList &input1 = inputgroupmap[inputid1]; 68 const InputGroupList &input2 = inputgroupmap[inputid2]; 69 if (input1.empty() || input2.empty()) 70 return 0; 71 72 InputGroupList::const_iterator it; 73 for (it = input1.begin(); it != input1.end(); ++it) 74 { 75 if (find(input2.begin(), input2.end(), *it) != input2.end()) 76 return *it; 77 } 78 79 return 0; 80 } -
libs/libmythtv/tv_rec.h
11 11 #include <qwaitcondition.h> 12 12 13 13 #include "inputinfo.h" 14 #include "inputgroupmap.h" 14 15 #include "mythdeque.h" 15 16 #include "programinfo.h" 16 17 #include "tv.h" … … 347 348 int overRecordSecNrml; 348 349 int overRecordSecCat; 349 350 QString overRecordCategory; 351 InputGroupMap igrp; 350 352 351 353 // Configuration variables from setup routines 352 354 int cardid; -
libs/libmythtv/inputgroupmap.h
1 // -*- Mode: c++ -*- 2 #ifndef _INPUTGROUPMAP_H_ 3 #define _INPUTGROUPMAP_H_ 4 5 // C++ headers 6 #include <vector> 7 using namespace std; 8 9 // Qt headers 10 #include <qmap.h> 11 12 typedef vector<uint> InputGroupList; 13 14 class InputGroupMap 15 { 16 public: 17 InputGroupMap() { Build(); } 18 19 bool Build(void); 20 uint GetSharedInputGroup(uint input1, uint input2) const; 21 22 private: 23 QMap<uint, InputGroupList> inputgroupmap; 24 }; 25 26 #endif // _INPUTGROUPMAP_H_ -
programs/mythbackend/scheduler.h
16 16 #include "scheduledrecording.h" 17 17 #include "programinfo.h" 18 18 #include "remoteutil.h" 19 #include "inputgroupmap.h" 19 20 20 21 class EncoderLink; 21 22 class MainServer; … … 34 35 typedef RecList::const_iterator RecConstIter; 35 36 typedef RecList::iterator RecIter; 36 37 37 typedef vector<int> InputGroupList;38 39 38 class Scheduler : public QObject 40 39 { 41 40 public: … … 130 129 int FillRecordingDir(ProgramInfo *pginfo, RecList& reclist); 131 130 void FillDirectoryInfoCache(bool force = false); 132 131 133 void BuildInputGroupMap(void);134 int GetSharedInputGroup(int, int) const;135 136 132 QValueList<int> reschedQueue; 137 133 QMutex reschedLock; 138 134 QMutex recordmatchLock; … … 143 139 QMap<int, RecList> cardlistmap; 144 140 QMap<int, RecList> recordidlistmap; 145 141 QMap<QString, RecList> titlelistmap; 146 QMap<int, InputGroupList> inputgroupmap;142 InputGroupMap igrp; 147 143 148 144 QMutex *reclist_lock; 149 145 bool reclist_changed; -
programs/mythbackend/scheduler.cpp
300 300 schedMoveHigher = (bool)gContext->GetNumSetting("SchedMoveHigher"); 301 301 schedTime = QDateTime::currentDateTime(); 302 302 303 BuildInputGroupMap();304 305 303 VERBOSE(VB_SCHEDULE, "BuildWorkList..."); 306 304 BuildWorkList(); 307 305 VERBOSE(VB_SCHEDULE, "AddNewRecords..."); … … 815 813 cout << QString("\n comparing with '%1' ").arg(q->title); 816 814 817 815 if (p->cardid != 0 && (p->cardid != q->cardid) && 818 ! GetSharedInputGroup(p->inputid, q->inputid))816 !igrp.GetSharedInputGroup(p->inputid, q->inputid)) 819 817 { 820 818 if (is_conflict_dbg) 821 819 cout << " cardid== "; … … 845 843 cout << "\n" << 846 844 QString(" cardid's: %1, %2 ").arg(p->cardid).arg(q->cardid) + 847 845 QString("Shared input group: %1 ") 848 .arg( GetSharedInputGroup(p->inputid, q->inputid)) +846 .arg(igrp.GetSharedInputGroup(p->inputid, q->inputid)) + 849 847 QString("mplexid's: %1, %2") 850 848 .arg(p->GetMplexID()).arg(q->GetMplexID()); 851 849 852 850 // if two inputs are in the same input group we have a conflict 853 851 // unless the programs are on the same multiplex. 854 852 if (p->cardid && (p->cardid != q->cardid) && 855 GetSharedInputGroup(p->inputid, q->inputid) &&853 igrp.GetSharedInputGroup(p->inputid, q->inputid) && 856 854 p->GetMplexID() && (p->GetMplexID() == q->GetMplexID())) 857 855 { 858 856 continue; … … 3365 3363 fsInfoCacheFillTime = QDateTime::currentDateTime(); 3366 3364 } 3367 3365 3368 void Scheduler::BuildInputGroupMap(void)3369 {3370 inputgroupmap.clear();3371 MSqlQuery query(dbConn);3372 3373 query.prepare("SELECT cardinputid, inputgroupid from inputgroup");3374 if (!query.exec())3375 {3376 MythContext::DBError("BuildInputGroupMap 1", query);3377 }3378 else3379 {3380 while (query.next())3381 {3382 int inputid = query.value(0).toUInt();3383 int groupid = query.value(1).toUInt();3384 inputgroupmap[inputid].push_back(groupid);3385 }3386 }3387 3388 query.prepare("SELECT cardinputid, cardid from cardinput");3389 if (!query.exec())3390 {3391 MythContext::DBError("BuildInputGroupMap 2", query);3392 }3393 else3394 {3395 while (query.next())3396 {3397 int inputid = query.value(0).toUInt();3398 int groupid = query.value(1).toUInt() + 1000;3399 if (inputgroupmap[inputid].empty())3400 inputgroupmap[inputid].push_back(groupid);3401 }3402 }3403 }3404 3405 int Scheduler::GetSharedInputGroup(int inputid1, int inputid2) const3406 {3407 const InputGroupList &input1 = inputgroupmap[inputid1];3408 const InputGroupList &input2 = inputgroupmap[inputid2];3409 if (input1.empty() || input2.empty())3410 return 0;3411 3412 InputGroupList::const_iterator it;3413 for (it = input1.begin(); it != input1.end(); ++it)3414 {3415 if (find(input2.begin(), input2.end(), *it) != input2.end())3416 return *it;3417 }3418 3419 return 0;3420 }3421 3422 3366 void Scheduler::SchedPreserveLiveTV(void) 3423 3367 { 3424 3368 if (!livetvTime.isValid())