Ticket #927: tuning1.diff
File tuning1.diff, 7.1 KB (added by , 18 years ago) |
---|
-
mythtv/libs/libmythtv/dvbchannel.h
65 65 bool SwitchToInput(const QString &inputname, const QString &chan); 66 66 bool SwitchToInput(int newcapchannel, bool setstarting); 67 67 bool Tune(const dvb_channel_t& channel, bool force_reset=false); 68 bool Tune_again(void); 68 69 69 70 // Set/Get/Command just for SIScan/ScanWizardScanner 70 71 void SetMultiplexID(int mplexid) { currentTID = mplexid; }; … … 100 101 dvb_frontend_info info; ///< Contains info on tuning hardware 101 102 dvb_channel_t chan_opts; ///< Tuning options sent to tuning hardware 102 103 DVBTuning prev_tuning; ///< Last tuning options sent to hardware 104 dvb_channel_t prev_channel; ///< Last tuning options sent to runing hardware 103 105 104 106 volatile int fd_frontend; ///< File descriptor for tuning hardware 105 107 int cardnum; ///< DVB Card number … … 111 113 bool first_tune; ///< Used to force hardware reset 112 114 113 115 int nextcapchannel; ///< Signal an input change 116 int frequency_incr; ///< Incrementer/decrementer for tuning 114 117 }; 115 118 116 119 #endif -
mythtv/libs/libmythtv/dvbchannel.cpp
86 86 bzero(&info, sizeof(info)); 87 87 has_crc_bug = CardUtil::HasDVBCRCBug(aCardNum); 88 88 sigmon_delay = CardUtil::GetMinSignalMonitoringDelay(aCardNum); 89 frequency_incr = -10; 89 90 } 90 91 91 92 DVBChannel::~DVBChannel() … … 603 604 bool has_diseq = (FE_QPSK == info.type) && diseqc; 604 605 struct dvb_frontend_parameters params = channel.tuning.params; 605 606 607 prev_channel.tuning = channel.tuning; 608 606 609 if (fd_frontend < 0) 607 610 { 608 611 ERROR("DVBChannel::Tune: Card not open!"); … … 630 633 // Adjust for Satelite recievers which offset the frequency. 631 634 params.frequency = tuned_frequency(channel.tuning, info.type, NULL); 632 635 636 frequency_incr = 0 - frequency_incr; 637 params.frequency = params.frequency + frequency_incr; 638 633 639 if (ioctl(fd_frontend, FE_SET_FRONTEND, ¶ms) < 0) 634 640 { 635 641 ERRNO("DVBChannel::Tune: " … … 652 658 return true; 653 659 } 654 660 661 /** \fn DVBChannel::Tune_again(void) 662 * \brief Calls DVBChannel::Tune() with the last known parameters 663 * \return DVBChannel::Tune() 664 */ 665 bool DVBChannel::Tune_again(void) 666 { 667 return Tune(prev_channel, true); 668 } 669 655 670 /** \fn DVBChannel::GetTuningParams(DVBTuning& tuning) const 656 671 * \brief Fetches DVBTuning params from driver 657 672 * \return true on success, false on failure -
mythtv/libs/libmythtv/tv_rec.cpp
136 136 // RingBuffer info 137 137 ringBuffer(NULL), rbFilePrefix(""), rbFileExt("mpg") 138 138 { 139 // Retune stuff 140 retune_timer = new TuningTimer(); 141 retune_timer->setTimeout(10000); 142 retune_timer->start(); 143 retune_requests = 0; 139 144 } 140 145 141 146 bool TVRec::CreateChannel(const QString &startchannel) … … 3262 3267 */ 3263 3268 void TVRec::HandleTuning(void) 3264 3269 { 3270 bool handle_done = false; 3271 3265 3272 if (tuningRequests.size()) 3266 3273 { 3267 3274 const TuningRequest *request = &tuningRequests.front(); … … 3273 3280 kFlagEITScan|kFlagAntennaAdjust)) 3274 3281 { 3275 3282 if (!recorder) 3283 { 3276 3284 TuningFrequency(*request); 3285 retune_timer->restart(); 3286 retune_timer->addMSecs(1); 3287 retune_requests = 0; 3288 } 3277 3289 else 3278 3290 SetFlags(kFlagWaitingForRecPause); 3279 3291 } … … 3302 3314 if (HasFlags(kFlagWaitingForSignal)) 3303 3315 { 3304 3316 if (!TuningSignalCheck()) 3305 return;3317 handle_done = true; 3306 3318 } 3307 3319 3308 3320 if (HasFlags(kFlagWaitingForSIParser)) 3309 3321 { 3310 3322 if (!TuningPMTCheck()) 3311 return;3323 handle_done = true; 3312 3324 } 3313 3325 3326 #ifdef USING_DVB 3327 if (HasFlags(kFlagWaitingForSignal) || // Just because we have signal, we 3328 HasFlags(kFlagWaitingForSIParser)) // may not have the right transponder 3329 if (!retune_timer->elapsed() && (retune_requests < 30)) 3330 { 3331 RetuneChannel(); 3332 retune_requests++; 3333 } 3334 #endif // USING_DVB 3335 3336 if (handle_done) 3337 return; 3338 3314 3339 if (HasFlags(kFlagNeedToStartRecorder)) 3315 3340 { 3316 3341 if (recorder) … … 3452 3477 ClearFlags(kFlagPendingActions); 3453 3478 } 3454 3479 3480 /** \fn TVRec::RetuneChannel(void) 3481 * \brief Retunes a DVB channel 3482 * \return DVBChannel::Tune_again() or false if ifndef USING_DVB 3483 */ 3484 bool TVRec::RetuneChannel(void) 3485 { 3486 #ifdef USING_DVB 3487 if (GetDVBChannel()) 3488 return GetDVBChannel()->Tune_again(); 3489 #endif // USING_DVB 3490 return false; 3491 } 3492 3455 3493 /** \fn TVRec::TuningFrequency(const TuningRequest&) 3456 3494 * \brief Performs initial tuning required for any tuning event. 3457 3495 * -
mythtv/libs/libmythtv/tv_rec.h
13 13 #include "mythdeque.h" 14 14 #include "programinfo.h" 15 15 #include "tv.h" 16 #include "util.h" 16 17 17 18 #include "mythconfig.h" 18 19 … … 51 52 BROWSE_FAVORITE ///< Fetch information on the next favorite channel 52 53 } BrowseDirections; 53 54 55 class TuningTimer 56 { 57 public: 58 TuningTimer() {} 59 60 void setTimeout(long t) { _timeout = t; } 61 long timeout(void) { return _timeout; } 62 void start() { t_timer.start(); } 63 int restart() { int ret = elapsed(); 64 t_timer.restart(); 65 return ret; 66 } 67 int elapsed() { int ret = t_timer.elapsed(); 68 if (ret > _timeout) { ret = 0; t_timer.restart(); } 69 return ret; 70 } 71 72 void addMSecs(int ms) { t_timer.addMSecs(ms); } 73 74 private: 75 QTime t_timer; 76 long _timeout; 77 }; 78 54 79 class GeneralDBOptions 55 80 { 56 81 public: … … 281 306 bool TuningPMTCheck(void); 282 307 void TuningNewRecorder(void); 283 308 void TuningRestartRecorder(void); 309 bool RetuneChannel(void); 284 310 uint TuningCheckForHWChange(const TuningRequest&, 285 311 QString &channum, 286 312 QString &inputname); … … 371 397 QString rbFilePrefix; 372 398 QString rbFileExt; 373 399 400 // Retune stuff 401 TuningTimer *retune_timer; 402 int retune_requests; 403 374 404 public: 375 405 static const uint kEITScanStartTimeout; 376 406 static const uint kSignalMonitoringRate;