Ticket #1133: 1133-v1.patch
File 1133-v1.patch, 34.4 KB (added by , 18 years ago) |
---|
-
libs/libmythtv/recordingprofile.h
75 75 RecordingProfile(QString profName = NULL); 76 76 virtual void loadByID(int id); 77 77 virtual bool loadByCard(QString name, int cardid); 78 virtual bool loadByType(QString name, QString cardtype); 78 79 virtual bool loadByGroup(QString name, QString group); 79 80 virtual int exec(); 80 81 -
libs/libmythtv/NuppelVideoPlayer.cpp
2443 2443 2444 2444 if ((!paused || eof) && livetvchain) 2445 2445 { 2446 cerr<<"."; 2446 2447 if (livetvchain->NeedsToSwitch()) 2447 2448 SwitchToProgram(); 2448 2449 else if (livetvchain->NeedsToJump()) -
libs/libmythtv/tv_play.cpp
28 28 #include "jobqueue.h" 29 29 #include "audiooutput.h" 30 30 #include "DisplayRes.h" 31 #include "signalmonitor .h"31 #include "signalmonitorvalue.h" 32 32 #include "scheduledrecording.h" 33 33 #include "config.h" 34 34 #include "livetvchain.h" … … 1033 1033 stateLock.unlock(); 1034 1034 } 1035 1035 1036 uint TV::GetLockTimeout(uint cardid)1037 {1038 uint timeout = 0xffffffff;1039 MSqlQuery query(MSqlQuery::InitCon());1040 query.prepare("SELECT channel_timeout, cardtype "1041 "FROM capturecard "1042 "WHERE cardid = :CARDID");1043 query.bindValue(":CARDID", cardid);1044 if (!query.exec() || !query.isActive())1045 MythContext::DBError("Getting timeout", query);1046 else if (query.next() &&1047 SignalMonitor::IsSupported(query.value(1).toString()))1048 timeout = max(query.value(0).toInt(), 500);1049 1050 VERBOSE(VB_PLAYBACK, LOC + QString("GetLockTimeout(%1): "1051 "Set lock timeout to %2 ms")1052 .arg(cardid).arg(timeout));1053 1054 return timeout;1055 }1056 1057 1036 /** \fn TV::StartRecorder(RemoteEncoder*, int) 1058 1037 * \brief Starts recorder, must be called before StartPlayer(). 1059 1038 * \param maxWait How long to wait for RecorderBase to start recording. … … 1077 1056 VERBOSE(VB_PLAYBACK, LOC + "StartRecorder(): took "<<t.elapsed() 1078 1057 <<" ms to start recorder."); 1079 1058 1080 // Get timeout for this recorder1081 lockTimeout[rec->GetRecorderNumber()] =1082 GetLockTimeout(rec->GetRecorderNumber());1083 1084 1059 // Cache starting frame rate for this recorder 1085 1060 if (rec == recorder) 1086 1061 frameRate = recorder->GetFrameRate(); … … 3465 3440 3466 3441 // Pause the backend recorder, send command, and then unpause.. 3467 3442 PauseLiveTV(); 3468 activerecorder->ToggleInputs(); 3443 lockTimerOn = false; 3444 QString inputname = activerecorder->SetInput("SwitchToNextInput"); 3469 3445 UnpauseLiveTV(); 3470 3446 3471 3447 // If activenvp is main nvp, show new input in on screen display 3472 3448 if (nvp && activenvp == nvp) 3473 UpdateOSDInput( );3449 UpdateOSDInput(inputname); 3474 3450 } 3475 3451 3476 3452 void TV::ToggleChannelFavorite(void) … … 4025 4001 update_osd_pos = true; 4026 4002 } 4027 4003 4028 void TV::UpdateOSDInput( void)4004 void TV::UpdateOSDInput(QString inputname) 4029 4005 { 4006 QString displayName = QString::null; 4007 4030 4008 if (!activerecorder || !tvchain) 4031 4009 return; 4032 4010 4033 QString name = tvchain->GetInputName(-1); 4034 QString displayName = ""; 4035 QString msg; 4011 int cardid = activerecorder->GetRecorderNumber(); 4036 4012 4013 if (inputname.isEmpty()) 4014 inputname = tvchain->GetInputName(-1); 4015 4016 // Try to get display name 4037 4017 MSqlQuery query(MSqlQuery::InitCon()); 4038 query.prepare("SELECT displayname FROM cardinput " 4039 "WHERE cardid = :CARDID AND inputname = :INPUTNAME"); 4040 query.bindValue(":CARDID", activerecorder->GetRecorderNumber()); 4041 query.bindValue(":INPUTNAME", name); 4042 query.exec(); 4043 if (query.isActive() && query.size() > 0) 4044 { 4045 query.next(); 4018 query.prepare("SELECT displayname " 4019 "FROM cardinput " 4020 "WHERE inputname = :INPUTNAME AND " 4021 " cardid = :CARDID"); 4022 query.bindValue(":CARDID", cardid); 4023 query.bindValue(":INPUTNAME", inputname); 4024 if (query.exec() && query.isActive() && query.size() && query.next()) 4046 4025 displayName = query.value(0).toString(); 4047 }4048 4026 4049 if ( displayName == "") 4050 msg = QString("%1: %2") 4051 .arg(activerecorder->GetRecorderNumber()).arg(name); 4052 else 4053 msg = displayName; 4027 // If a display name doesn't exist use cardid and inputname 4028 if (displayName.isEmpty()) 4029 displayName = QString("%1: %2").arg(cardid).arg(inputname); 4054 4030 4055 4031 if (GetOSD()) 4056 GetOSD()->SetSettingsText( msg, 3);4032 GetOSD()->SetSettingsText(displayName, 3); 4057 4033 } 4058 4034 4059 4035 /** \fn TV::UpdateOSDSignal(const QStringList&) … … 4179 4155 bool timed_out = false; 4180 4156 if (activerecorder) 4181 4157 { 4182 uint timeout = lockTimeout[activerecorder->GetRecorderNumber()]; 4158 QString input = activerecorder->GetInput(); 4159 uint timeout = activerecorder->GetSignalLockTimeout(input); 4183 4160 timed_out = lockTimerOn && ((uint)lockTimer.elapsed() > timeout); 4184 4161 } 4185 4162 OSD *osd = GetOSD(); … … 6019 5996 osdlock.unlock(); 6020 5997 6021 5998 lockTimerOn = false; 6022 uint timeout = lockTimeout[activerecorder->GetRecorderNumber()]; 5999 6000 QString input = activerecorder->GetInput(); 6001 uint timeout = activerecorder->GetSignalLockTimeout(input); 6023 6002 if (timeout < 0xffffffff) 6024 6003 { 6025 6004 lockTimer.start(); -
libs/libmythtv/remoteencoder.h
39 39 void CancelNextRecording(bool cancel); 40 40 41 41 void SetLiveRecording(bool recording); 42 void ToggleInputs(void); 42 QStringList GetInputs(void); 43 QString GetInput(void); 44 QString SetInput(QString); 43 45 int ChangeContrast(bool direction); 44 46 int ChangeBrightness(bool direction); 45 47 int ChangeColour(bool direction); … … 48 50 void ChangeDeinterlacer(int deint_mode); 49 51 void ToggleChannelFavorite(void); 50 52 void SetChannel(QString channel); 51 int SetSignalMonitoringRate(int msec, bool notifyFrontend = true); 53 int SetSignalMonitoringRate(int msec, bool notifyFrontend = true); 54 uint GetSignalLockTimeout(QString input); 52 55 bool CheckChannel(QString channel); 53 56 bool ShouldSwitchToAnotherCard(QString channelid); 54 57 bool CheckChannelPrefix(const QString&,uint&,bool&,QString&); -
libs/libmythtv/dvbchannel.cpp
176 176 .arg(it.key()).arg(*it) 177 177 .arg(inputChannel[it.key()])); 178 178 } 179 currentcapchannel = nextcapchannel = GetNextInput ();179 currentcapchannel = nextcapchannel = GetNextInputNum(); 180 180 VERBOSE(VB_CHANNEL, LOC + QString("Current Input #%1: '%2'") 181 181 .arg(GetCurrentInputNum()).arg(GetCurrentInput())); 182 182 } … … 326 326 bool DVBChannel::SwitchToInput(int newcapchannel, bool setstarting) 327 327 { 328 328 (void)setstarting; 329 if (inputChannel[newcapchannel] != "")330 329 if (!inputChannel[newcapchannel].isEmpty()) 330 { 331 331 nextcapchannel = newcapchannel; 332 332 return SetChannelByString(inputChannel[newcapchannel]); 333 333 } -
libs/libmythtv/tv_play.h
186 186 bool RequestNextRecorder(bool showDialogs); 187 187 void DeleteRecorder(); 188 188 189 static uint GetLockTimeout(uint cardid);190 189 bool StartRecorder(RemoteEncoder *rec, int maxWait=-1); 191 190 bool StartPlayer(bool isWatchingRecording, int maxWait=-1); 192 191 void StartOSD(void); … … 269 268 void ToggleOSD(bool includeStatusOSD); 270 269 void UpdateOSDProgInfo(const char *whichInfo); 271 270 void UpdateOSDSeekMessage(const QString &mesg, int disptime); 272 void UpdateOSDInput( void);271 void UpdateOSDInput(QString inputname = QString::null); 273 272 void UpdateOSDTextEntry(const QString &message); 274 273 void UpdateOSDSignal(const QStringList& strlist); 275 274 void UpdateOSDTimeoutMessage(void); … … 434 433 // Channel changing timeout notification variables 435 434 QTime lockTimer; 436 435 bool lockTimerOn; 437 QMap<uint,uint> lockTimeout;438 436 439 437 // Previous channel functionality state variables 440 438 str_vec_t prevChan; ///< Previous channels -
libs/libmythtv/remoteencoder.cpp
8 8 #include "programinfo.h" 9 9 #include "util.h" 10 10 #include "mythcontext.h" 11 #include "signalmonitor.h" 11 12 12 13 RemoteEncoder::RemoteEncoder(int num, const QString &host, short port) 13 14 : recordernum(num), controlSock(NULL), remotehost(host), … … 313 314 SendReceiveStringList(strlist); 314 315 } 315 316 316 void RemoteEncoder::ToggleInputs(void)317 QStringList RemoteEncoder::GetInputs(void) 317 318 { 318 319 QStringList strlist = QString("QUERY_RECORDER %1").arg(recordernum); 319 strlist << " TOGGLE_INPUTS";320 strlist << "GET_INPUTS"; 320 321 321 322 SendReceiveStringList(strlist); 322 323 324 return strlist; 325 } 326 327 QString RemoteEncoder::GetInput(void) 328 { 329 QStringList strlist = QString("QUERY_RECORDER %1").arg(recordernum); 330 strlist << "GET_INPUT"; 331 332 SendReceiveStringList(strlist); 333 334 return strlist[0]; 335 } 336 337 QString RemoteEncoder::SetInput(QString input) 338 { 339 QStringList strlist = QString("QUERY_RECORDER %1").arg(recordernum); 340 strlist << "SET_INPUT"; 341 strlist << input; 342 343 SendReceiveStringList(strlist); 344 323 345 lastchannel = ""; 346 347 return strlist[0]; 324 348 } 325 349 326 350 void RemoteEncoder::ToggleChannelFavorite(void) … … 382 406 return retval; 383 407 } 384 408 409 uint RemoteEncoder::GetSignalLockTimeout(QString input) 410 { 411 uint cardid = recordernum; 412 uint timeout = 0xffffffff; 413 MSqlQuery query(MSqlQuery::InitCon()); 414 query.prepare("SELECT channel_timeout, cardtype " 415 "FROM capturecard " 416 "WHERE cardid = :CARDID"); 417 query.bindValue(":CARDID", cardid); 418 if (!query.exec() || !query.isActive()) 419 MythContext::DBError("Getting timeout", query); 420 else if (query.next() && 421 SignalMonitor::IsSupported(query.value(1).toString())) 422 timeout = max(query.value(0).toInt(), 500); 423 424 VERBOSE(VB_PLAYBACK, "RemoteEncoder: " + 425 QString("GetSignalLockTimeout(%1): Set lock timeout to %2 ms") 426 .arg(cardid).arg(timeout)); 427 428 return timeout; 429 } 430 385 431 /** \fn RemoteEncoder::ChangeContrast(bool) 386 432 * \brief Changes contrast of a recording. 387 433 * -
libs/libmythtv/dbcheck.cpp
1990 1990 return false; 1991 1991 } 1992 1992 1993 if (dbver == "1122") 1994 { 1995 const QString updates[] = { 1996 "ALTER TABLE cardinput ADD COLUMN inputtype VARCHAR(20) NOT NULL DEFAULT '';", 1997 "ALTER TABLE cardinput ADD COLUMN inputdev VARCHAR(128) NOT NULL DEFAULT '';", 1998 "" 1999 }; 2000 if (!performActualUpdate(updates, "1123", dbver)) 2001 return false; 2002 } 2003 1993 2004 // Drop xvmc_buffer_settings table in 0.20 1994 2005 // Drop dvb_dmx_buf_size and dvb_pkt_buf_size columns of channel in 0.20 1995 2006 -
libs/libmythtv/livetvchain.cpp
460 460 */ 461 461 void LiveTVChain::SwitchToNext(bool up) 462 462 { 463 //VERBOSE(VB_PLAYBACK, LOC + "SwitchToNext("<<(up?"up":"down")<<")");463 VERBOSE(VB_PLAYBACK, LOC + "SwitchToNext("<<(up?"up":"down")<<")"); 464 464 if (up && HasNext()) 465 465 SwitchTo(m_curpos + 1); 466 466 else if (!up && HasPrev()) … … 475 475 476 476 void LiveTVChain::JumpToNext(bool up, int pos) 477 477 { 478 VERBOSE(VB_PLAYBACK, LOC + "JumpToNext("<<(up?"up":"down") 479 <<", "<<pos<<")"); 478 480 m_jumppos = pos; 479 481 SwitchToNext(up); 480 482 } -
libs/libmythtv/tv_rec.cpp
132 132 { 133 133 } 134 134 135 /** \fn TVRec::Init() 136 * \brief Performs instance initialization, returns true on success. 137 * 138 * \return Returns true on success, false on failure. 139 */ 140 bool TVRec::Init(void) 135 bool TVRec::CreateChannel(void) 141 136 { 142 QMutexLocker lock(&stateChangeLock);143 144 bool ok = GetDevices(cardid, genOpt, dvbOpt, fwOpt, dboxOpt);145 146 if (!ok)147 return false;148 149 137 QString startchannel = GetStartChannel(cardid, genOpt.defaultinput); 150 151 138 bool init_run = false; 152 139 if (genOpt.cardtype == "DVB") 153 140 { 154 141 #ifdef USING_DVB_EIT 155 scanner = new EITScanner(); 142 if (!scanner) 143 scanner = new EITScanner(); 156 144 #endif // USING_DVB_EIT 157 145 158 146 #ifdef USING_DVB … … 203 191 rbFileExt = "nuv"; 204 192 } 205 193 206 if (!init_run) 207 { 208 QString msg = QString( 209 "%1 card configured on video device %2, \n" 210 "but MythTV was not compiled with %2 support. \n" 211 "\n" 212 "Recompile MythTV with %3 support or remove the card \n" 213 "from the configuration and restart MythTV.") 214 .arg(genOpt.cardtype).arg(genOpt.videodev) 215 .arg(genOpt.cardtype).arg(genOpt.cardtype); 216 VERBOSE(VB_IMPORTANT, LOC_ERR + msg); 217 SetFlags(kFlagErrored); 194 if (init_run) 195 return true; 196 197 QString msg = QString( 198 "%1 card configured on video device %2, \n" 199 "but MythTV was not compiled with %2 support. \n" 200 "\n" 201 "Recompile MythTV with %3 support or remove the card \n" 202 "from the configuration and restart MythTV.") 203 .arg(genOpt.cardtype).arg(genOpt.videodev) 204 .arg(genOpt.cardtype).arg(genOpt.cardtype); 205 206 VERBOSE(VB_IMPORTANT, LOC_ERR + msg); 207 208 SetFlags(kFlagErrored); 209 210 return false; 211 } 212 213 /** \fn TVRec::Init(void) 214 * \brief Performs instance initialization, returns true on success. 215 * 216 * \return Returns true on success, false on failure. 217 */ 218 bool TVRec::Init(void) 219 { 220 QMutexLocker lock(&stateChangeLock); 221 222 if (!GetDevices(cardid, genOpt, dvbOpt, fwOpt, dboxOpt) || !CreateChannel()) 218 223 return false; 219 }220 224 225 origGenOpt = genOpt; 226 221 227 transcodeFirst = 222 228 gContext->GetNumSetting("AutoTranscodeBeforeAutoCommflag", 0); 223 229 earlyCommFlag = gContext->GetNumSetting("AutoCommflagWhileRecording", 0); … … 1650 1656 1651 1657 if (SignalMonitor::IsSupported(genOpt.cardtype) && channel->Open()) 1652 1658 { 1653 // TODO reset the tuner hardware1654 //channel->SwitchToInput(channel->GetCurrentInputNum(), true);1655 1656 1659 signalMonitor = SignalMonitor::Init(genOpt.cardtype, cardid, channel); 1657 1660 } 1658 1661 … … 2979 2982 return ret; 2980 2983 } 2981 2984 2985 /** \fn TVRec::GetConnectedInputs(void) const 2986 * \brief Returns TVRec's recorders connected inputs. 2987 */ 2988 QStringList TVRec::GetConnectedInputs(void) const 2989 { 2990 QStringList list; 2991 if (channel) 2992 list = channel->GetConnectedInputs(); 2993 return list; 2994 } 2995 2996 /** \fn TVRec::GetInput(void) const 2997 * \brief Returns current input. 2998 */ 2999 QString TVRec::GetInput(void) const 3000 { 3001 if (channel) 3002 return channel->GetCurrentInput(); 3003 return QString::null; 3004 } 3005 3006 /** \fn TVRec::SetInput(QString) 3007 * \brief Changes to the specified input. 3008 * 3009 * You must call PauseRecorder(void) before calling this. 3010 * 3011 * \param input Input to switch to, or "SwitchToNectInput". 3012 * \return input we have switched to 3013 */ 3014 QString TVRec::SetInput(QString input, uint requestType) 3015 { 3016 QMutexLocker lock(&stateChangeLock); 3017 QString origIn = input; 3018 VERBOSE(VB_RECORD, LOC + "SetInput("<<input<<") -- begin"); 3019 3020 if (!channel) 3021 { 3022 VERBOSE(VB_RECORD, LOC + "SetInput() -- end no channel class"); 3023 return QString::null; 3024 } 3025 3026 input = (input == "SwitchToNextInput") ? channel->GetNextInput() : input; 3027 3028 if (input == channel->GetCurrentInput()) 3029 { 3030 VERBOSE(VB_RECORD, LOC + "SetInput("<<origIn<<":"<<input 3031 <<") -- end nothing to do"); 3032 return input; 3033 } 3034 3035 QString name = channel->GetNextInputStartChan(); 3036 3037 // Detect tuning request type if needed 3038 if (requestType & kFlagDetect) 3039 { 3040 WaitForEventThreadSleep(); 3041 requestType = lastTuningRequest.flags & (kFlagRec | kFlagNoRec); 3042 } 3043 3044 // Clear the RingBuffer reset flag, in case we wait for a reset below 3045 ClearFlags(kFlagRingBufferReady); 3046 3047 // Actually add the tuning request to the queue, and 3048 // then wait for it to start tuning 3049 tuningRequests.enqueue(TuningRequest(requestType, name, input)); 3050 WaitForEventThreadSleep(); 3051 3052 // If we are using a recorder, wait for a RingBuffer reset 3053 if (requestType & kFlagRec) 3054 { 3055 while (!HasFlags(kFlagRingBufferReady)) 3056 WaitForEventThreadSleep(); 3057 } 3058 VERBOSE(VB_RECORD, LOC + "SetInput("<<origIn<<":"<<input<<") -- end"); 3059 3060 return GetInput(); 3061 } 3062 2982 3063 /** \fn TVRec::SetChannel(QString,uint) 2983 3064 * \brief Changes to a named channel on the current tuner. 2984 3065 * … … 3190 3271 { 3191 3272 if (tuningRequests.size()) 3192 3273 { 3274 VERBOSE(VB_RECORD, LOC + "Request: " + tuningRequests[0].toString()); 3193 3275 const TuningRequest *request = &tuningRequests.front(); 3194 VERBOSE(VB_RECORD, LOC + "Request: "<<request->toString());3195 3276 TuningShutdowns(*request); 3196 3277 3197 3278 // Now we start new stuff … … 3256 3337 */ 3257 3338 void TVRec::TuningShutdowns(const TuningRequest &request) 3258 3339 { 3340 QString curType(""), curDev(""), newType(""), newDev(""); 3341 if (channel && !request.input.isEmpty()) 3342 { 3343 QString current_input = channel->GetCurrentInput(); 3344 curType = channel->GetInputType(current_input, curDev); 3345 curType = curType.isEmpty() ? origGenOpt.cardtype : curType; 3346 curDev = curDev.isEmpty() ? origGenOpt.videodev : curDev; 3347 3348 newType = channel->GetInputType(request.input, newDev); 3349 newType = newType.isEmpty() ? origGenOpt.cardtype : newType; 3350 newDev = newDev.isEmpty() ? origGenOpt.videodev : newDev; 3351 } 3352 3353 VERBOSE(VB_IMPORTANT, LOC + "Tuner Type: <"<<curType<<":"<<newType<<">"); 3354 VERBOSE(VB_IMPORTANT, LOC + "Tuner Dev: <"<<curDev <<":"<<newDev <<">"); 3355 3356 bool force_teardown = false; 3357 if (curType != newType) 3358 { 3359 // TODO handle total shutdown... 3360 force_teardown = true; 3361 } 3362 3259 3363 #ifdef USING_DVB_EIT 3260 3364 if (!(request.flags & kFlagEITScan) && HasFlags(kFlagEITScannerRunning)) 3261 3365 { … … 3284 3388 3285 3389 // At this point any waits are canceled. 3286 3390 3287 if ((request.flags & kFlagNoRec) )3391 if ((request.flags & kFlagNoRec) || force_teardown) 3288 3392 { 3289 3393 if (HasFlags(kFlagDummyRecorderRunning)) 3290 3394 { … … 3309 3413 CloseChannel(); 3310 3414 // At this point the channel is shut down 3311 3415 } 3416 3417 if (force_teardown) 3418 { 3419 VERBOSE(VB_IMPORTANT, "Recreating channel..."); 3420 channel->Close(); 3421 delete channel; 3422 channel = NULL; 3423 genOpt.cardtype = newType; 3424 genOpt.videodev = newDev; 3425 genOpt.defaultinput = request.input; 3426 CreateChannel(); 3312 3427 3428 if (!(request.flags & kFlagNoRec)) 3429 channel->Open(); 3430 } 3431 3313 3432 if (ringBuffer && (request.flags & kFlagKillRingBuffer)) 3314 3433 { 3315 3434 VERBOSE(VB_RECORD, LOC + "Tearing down RingBuffer"); … … 3371 3490 3372 3491 if (!input.isEmpty()) 3373 3492 ok = channel->SwitchToInput(input, channum); 3374 else if (channum.find("ToggleInputs") >= 0)3375 ok = channel->ToggleInputs();3376 3493 else 3377 3494 ok = channel->SetChannelByString(channum); 3378 3495 } … … 3543 3660 return true; 3544 3661 } 3545 3662 3546 static void load_recording_profile(3547 RecordingProfile &profile, ProgramInfo *rec, int cardid)3548 {3549 QString profileName = "Live TV";3550 bool done = false;3551 3552 if (rec)3553 {3554 profileName = rec->GetScheduledRecording()->getProfileName();3555 if (!profileName.isEmpty())3556 done = profile.loadByCard(profileName, cardid);3557 profileName = (done) ? profileName : QString("Default");3558 }3559 3560 if (!done)3561 profile.loadByCard(profileName, cardid);3562 3563 QString msg = QString("Using profile '%1' to record").arg(profileName);3564 VERBOSE(VB_RECORD, LOC + msg);3565 }3566 3567 3663 static int init_jobs(const ProgramInfo *rec, RecordingProfile &profile, 3568 3664 bool on_host, bool transcode_bfr_comm, bool on_line_comm) 3569 3665 { … … 3622 3718 had_dummyrec = true; 3623 3719 } 3624 3720 3721 ProgramInfo *rec = lastTuningRequest.program; 3722 QString profileName = (tvchain) ? QString("Live TV") : 3723 rec->GetScheduledRecording()->getProfileName(); 3724 3625 3725 RecordingProfile profile; 3626 ProgramInfo *rec = lastTuningRequest.program; 3627 load_recording_profile(profile, rec, cardid); 3726 if (!profile.loadByType(profileName, genOpt.cardtype)) 3727 { 3728 profileName = "Default"; 3729 profile.loadByType(profileName, genOpt.cardtype); 3730 } 3731 3732 VERBOSE(VB_RECORD, LOC + QString("Using profile '%1' to record") 3733 .arg(profileName)); 3734 3628 3735 if (tvchain) 3629 3736 { 3630 3737 bool ok; … … 3634 3741 SetFlags(kFlagRingBufferReady); 3635 3742 } 3636 3743 else 3637 ok = SwitchLiveTVRingBuffer(true, !had_dummyrec );3744 ok = SwitchLiveTVRingBuffer(true, !had_dummyrec && recorder); 3638 3745 if (!ok) 3639 3746 { 3640 3747 VERBOSE(VB_IMPORTANT, LOC_ERR + "Failed to create RingBuffer 2"); … … 3725 3832 if (GetV4LChannel()) 3726 3833 channel->SetFd(recorder->GetVideoFd()); 3727 3834 3728 SetFlags(kFlagRecorderRunning );3835 SetFlags(kFlagRecorderRunning | kFlagRingBufferReady); 3729 3836 3730 3837 if (!tvchain) 3731 3838 autoRunJobs = init_jobs(rec, profile, runJobOnHostOnly, … … 3911 4018 } 3912 4019 } 3913 4020 if (kFlagRingBufferReady & f) 3914 msg += "RingBufferRe set,";4021 msg += "RingBufferReady,"; 3915 4022 3916 4023 if (msg.isEmpty()) 3917 4024 msg = QString("0x%1").arg(f,0,16); -
libs/libmythtv/recordingprofile.cpp
905 905 return false; 906 906 } 907 907 908 bool RecordingProfile::loadByType(QString name, QString cardtype) 909 { 910 QString hostname = gContext->GetHostName(); 911 int recid = 0; 912 913 MSqlQuery result(MSqlQuery::InitCon()); 914 result.prepare( 915 "SELECT recordingprofiles.id, profilegroups.hostname, " 916 " profilegroups.is_default " 917 "FROM recordingprofiles, profilegroups, capturecard " 918 "WHERE profilegroups.id = recordingprofiles.profilegroup AND " 919 " profilegroups.cardtype = :CARDTYPE AND " 920 " recordingprofiles.name = :NAME"); 921 result.bindValue(":CARDTYPE", cardtype); 922 result.bindValue(":NAME", name); 923 924 if (result.exec() && result.isActive() && result.size() > 0) 925 { 926 while (result.next()) 927 { 928 if (result.value(1).toString() == hostname) 929 { 930 recid = result.value(0).toInt(); 931 break; 932 } 933 else if (result.value(2).toInt() == 1) 934 recid = result.value(0).toInt(); 935 } 936 } 937 if (recid) 938 { 939 loadByID(recid); 940 return true; 941 } 942 return false; 943 } 944 908 945 bool RecordingProfile::loadByGroup(QString name, QString group) 909 946 { 910 947 MSqlQuery result(MSqlQuery::InitCon()); -
libs/libmythtv/channelbase.h
38 38 virtual bool Open(void) = 0; 39 39 /// \brief Closes the channel changing hardware to use. 40 40 virtual void Close(void) = 0; 41 /// \brief Switches to another input on hardware,42 /// and sets the channel is setstarting is true.43 virtual bool SwitchToInput(int newcapchannel, bool setstarting) = 0;44 41 virtual bool SetChannelByString(const QString &chan) = 0; 45 42 /// \brief Reports whether channel is already open 46 43 virtual bool IsOpen(void) const = 0; … … 60 57 { return currentcapchannel; } 61 58 virtual QString GetCurrentInput(void) const 62 59 { return channelnames[GetCurrentInputNum()]; } 60 virtual int GetNextInputNum(void) const; 61 virtual QString GetNextInput(void) const 62 { return channelnames[GetNextInputNum()]; } 63 virtual QString GetNextInputStartChan(void) 64 { return inputChannel[GetNextInputNum()]; } 65 virtual QString GetInputType(const QString&, QString&) const; 63 66 virtual QString GetOrdering(void) const 64 67 { return channelorder; } 68 virtual QStringList GetConnectedInputs(void) const; 65 69 /// \brief Returns true iff commercial detection is not required 66 70 // on current channel, for BBC, CBC, etc. 67 71 bool IsCommercialFree(void) const { return commfree; } … … 76 80 virtual bool SetChannelByDirection(ChannelChangeDirection); 77 81 78 82 // Input toggling convenience methods 79 virtual bool ToggleInputs(void);80 83 virtual bool SwitchToInput(const QString &input); 81 84 virtual bool SwitchToInput(const QString &input, const QString &chan); 82 85 … … 115 118 void StoreInputChannels(const QMap<int, QString> &inputChannel); 116 119 117 120 protected: 118 int GetNextInput(void) const; 121 /// \brief Switches to another input on hardware, 122 /// and sets the channel is setstarting is true. 123 virtual bool SwitchToInput(int newcapchannel, bool setstarting) = 0; 124 119 125 virtual int GetCardID(void) const; 120 126 virtual bool ChangeExternalChannel(const QString &newchan); 121 127 virtual void SetCachedATSCInfo(const QString &chan); -
libs/libmythtv/osd.cpp
1896 1896 char name[128]; 1897 1897 sprintf(name, "%lld-%d", number, type); 1898 1898 1899 int x pos= (int)((editarrowRect.width() * 1.0 / totalframes) * number);1900 xpos = (editarrowRect.left() + xpos) * wmult;1901 int ypos = editarrowRect.top() * hmult;1899 int xtmp = (int)((editarrowRect.width() * 1.0 / totalframes) * number); 1900 int xpos = (int) round((editarrowRect.left() + xtmp) * wmult); 1901 int ypos = (int) round(editarrowRect.top() * hmult); 1902 1902 1903 1903 osdlock.lock(); 1904 1904 -
libs/libmythtv/tv_rec.h
187 187 void ToggleChannelFavorite(void); 188 188 189 189 void SetLiveRecording(int recording); 190 /// Toggles between inputs on current capture card. 191 void ToggleInputs(void) { SetChannel("ToggleInputs"); } 190 191 QStringList GetConnectedInputs(void) const; 192 QString GetInput(void) const; 193 QString SetInput(QString input, uint requestType = kFlagDetect); 194 192 195 /// Changes to a channel in the 'dir' channel change direction. 193 196 void ChangeChannel(ChannelChangeDirection dir) 194 197 { SetChannel(QString("NextChannel %1").arg((int)dir)); } … … 249 252 HDTVRecorder *GetHDTVRecorder(void); 250 253 DVBRecorder *GetDVBRecorder(void); 251 254 255 bool CreateChannel(void); 252 256 void InitChannel(const QString &inputname, const QString &startchannel); 253 257 void CloseChannel(void); 254 258 DBox2Channel *GetDBox2Channel(void); … … 323 327 bool ispip; 324 328 325 329 // Configuration variables from database, based on cardid 326 GeneralDBOptions genOpt ;330 GeneralDBOptions genOpt, origGenOpt; 327 331 DVBDBOptions dvbOpt; 328 332 FireWireDBOptions fwOpt; 329 333 DBox2DBOptions dboxOpt; -
libs/libmythtv/channelbase.cpp
52 52 return fTune; 53 53 } 54 54 55 int ChannelBase::GetNextInput (void) const55 int ChannelBase::GetNextInputNum(void) const 56 56 { 57 57 QMap<int, QString>::const_iterator it; 58 58 it = channelnames.find(currentcapchannel); … … 80 80 return (i<100) ? it.key() : -1; 81 81 } 82 82 83 bool ChannelBase::ToggleInputs(void) 83 QStringList ChannelBase::GetConnectedInputs(void) const 84 84 { 85 int nextInput = GetNextInput(); 86 if (nextInput >= 0 && (nextInput != currentcapchannel)) 87 return SwitchToInput(nextInput, true); 88 return true; 85 QStringList list; 86 87 QMap<int, QString>::const_iterator it = channelnames.begin(); 88 for (; it != channelnames.end(); ++it) 89 if (!inputTuneTo[it.key()].isEmpty()) 90 list.push_back(it.data()); 91 92 return list; 89 93 } 90 94 91 95 QString ChannelBase::GetInputByNum(int capchannel) const … … 139 143 return ok; 140 144 } 141 145 146 QString ChannelBase::GetInputType(const QString &inputname, 147 QString &inputdevice) const 148 { 149 QString inputformat = QString::null; 150 151 MSqlQuery query(MSqlQuery::InitCon()); 152 query.prepare( 153 "SELECT inputtype, inputdev " 154 "FROM cardinput " 155 "WHERE cardid = :CARDID AND " 156 " inputname = :INPUTNAME"); 157 query.bindValue(":CARDID", GetCardID()); 158 query.bindValue(":INPUTNAME", inputname); 159 160 if (!query.exec() || !query.isActive()) 161 { 162 MythContext::DBError("GetInputFormat", query); 163 } 164 else if (query.next()) 165 { 166 inputformat = query.value(0).toString(); 167 inputdevice = query.value(1).toString(); 168 } 169 170 return inputformat; 171 } 172 142 173 bool ChannelBase::ChangeExternalChannel(const QString &channum) 143 174 { 144 175 if (externalChanger[currentcapchannel].isEmpty()) -
libs/libmythtv/channel.cpp
276 276 277 277 int inputNum = currentcapchannel; 278 278 if (currentcapchannel < 0) 279 inputNum = GetNextInput ();279 inputNum = GetNextInputNum(); 280 280 281 281 QString fmt = format; 282 282 if ((fmt == "Default") || format.isEmpty()) -
programs/mythbackend/encoderlink.h
76 76 void StopLiveTV(void); 77 77 void PauseRecorder(void); 78 78 void SetLiveRecording(int); 79 void ToggleInputs(void); 79 QStringList GetConnectedInputs(void) const; 80 QString GetInput(void) const; 81 QString SetInput(QString); 80 82 void ToggleChannelFavorite(void); 81 83 void ChangeChannel(int channeldirection); 82 84 void SetChannel(const QString &name); -
programs/mythbackend/mainserver.cpp
2473 2473 enc->SetLiveRecording(recording); 2474 2474 retlist << "ok"; 2475 2475 } 2476 else if (command == " TOGGLE_INPUTS")2476 else if (command == "GET_CONNECTED_INPUTS") 2477 2477 { 2478 enc->ToggleInputs(); 2479 retlist << "ok"; 2478 QStringList ret = enc->GetConnectedInputs(); 2479 if (ret.empty()) 2480 retlist << "EMPTY_LIST"; 2481 else 2482 retlist += ret; 2480 2483 } 2484 else if (command == "GET_INPUT") 2485 { 2486 QString ret = enc->GetInput(); 2487 ret = (ret.isEmpty()) ? "UNKNOWN" : ret; 2488 retlist << ret; 2489 } 2490 else if (command == "SET_INPUT") 2491 { 2492 QString input = slist[2]; 2493 QString ret = enc->SetInput(input); 2494 ret = (ret.isEmpty()) ? "UNKNOWN" : ret; 2495 retlist << ret; 2496 } 2481 2497 else if (command == "TOGGLE_CHANNEL_FAVORITE") 2482 2498 { 2483 2499 enc->ToggleChannelFavorite(); -
programs/mythbackend/encoderlink.cpp
654 654 VERBOSE(VB_IMPORTANT, "Should be local only query: SetLiveRecording"); 655 655 } 656 656 657 /** \fn EncoderLink:: ToggleInputs(void)658 * \brief Tells TVRec's recorder to change to the next input.657 /** \fn EncoderLink::GetConnectedInputs(void) const 658 * \brief Returns TVRec's recorders connected inputs. 659 659 * <b>This only works on local recorders.</b> 660 660 * 661 * You must call PauseRecorder(void) before calling this.661 * \sa TVRec::GetConnectedInputs(void) const 662 662 */ 663 void EncoderLink::ToggleInputs(void) 663 QStringList EncoderLink::GetConnectedInputs(void) const 664 664 { 665 QStringList list; 666 665 667 if (local) 666 tv->ToggleInputs();668 list = tv->GetConnectedInputs(); 667 669 else 668 VERBOSE(VB_IMPORTANT, "Should be local only query: ToggleInputs"); 670 VERBOSE(VB_IMPORTANT, "Should be local only query: GetConnectedInputs"); 671 672 return list; 669 673 } 670 674 675 /** \fn EncoderLink::GetInput(void) const 676 * \brief Returns TVRec's recorders current input. 677 * <b>This only works on local recorders.</b> 678 * 679 * \sa TVRec::GetInput(void) const 680 */ 681 QString EncoderLink::GetInput(void) const 682 { 683 if (local) 684 return tv->GetInput(); 685 686 VERBOSE(VB_IMPORTANT, "Should be local only query: GetInput"); 687 return QString::null; 688 } 689 690 /** \fn EncoderLink::SetInput(QString) 691 * \brief Tells TVRec's recorder to change to the specified input. 692 * <b>This only works on local recorders.</b> 693 * 694 * You must call PauseRecorder(void) before calling this. 695 * 696 * \param input Input to switch to, or "SwitchToNectInput". 697 * \return input we have switched to 698 * \sa TVRec::SetInput(QString) 699 */ 700 QString EncoderLink::SetInput(QString input) 701 { 702 if (local) 703 return tv->SetInput(input); 704 705 VERBOSE(VB_IMPORTANT, "Should be local only query: SetInput"); 706 return QString::null; 707 } 708 671 709 /** \fn EncoderLink::ToggleChannelFavorite(void) 672 710 * \brief Toggles whether the current channel should be on our favorites list. 673 711 * <b>This only works on local recorders.</b>