diff -rup libmythtv.no_hack/dvbchannel.cpp libmythtv/dvbchannel.cpp
old
|
new
|
DVBChannel::DVBChannel(int aCardNum, TVR
|
82 | 82 | dvbcam = new DVBCam(cardnum); |
83 | 83 | bzero(&info, sizeof(info)); |
84 | 84 | has_crc_bug = CardUtil::HasDVBCRCBug(aCardNum); |
| 85 | frequency_incr = -10; |
85 | 86 | } |
86 | 87 | |
87 | 88 | DVBChannel::~DVBChannel() |
… |
… |
bool DVBChannel::Tune(const dvb_channel_
|
642 | 643 | bool has_diseq = (FE_QPSK == info.type) && diseqc; |
643 | 644 | struct dvb_frontend_parameters params = channel.tuning.params; |
644 | 645 | |
| 646 | prev_channel.tuning = channel.tuning; |
| 647 | |
645 | 648 | // (begin)softcam-0.4 |
646 | 649 | GENERAL(QString("invalidating DeCSA for card %1").arg(cardnum)); |
647 | 650 | //DVBRecorder::UpdateDeCSAKeys(cardnum, 'I', 0, NULL, 0); |
… |
… |
bool DVBChannel::Tune(const dvb_channel_
|
674 | 677 | // Adjust for Satelite recievers which offset the frequency. |
675 | 678 | params.frequency = tuned_frequency(channel.tuning, info.type, NULL); |
676 | 679 | |
| 680 | frequency_incr = 0 - frequency_incr; |
| 681 | params.frequency = params.frequency + frequency_incr; |
| 682 | |
677 | 683 | if (ioctl(fd_frontend, FE_SET_FRONTEND, ¶ms) < 0) |
678 | 684 | { |
679 | 685 | ERRNO("DVBChannel::Tune: " |
… |
… |
bool DVBChannel::Tune(const dvb_channel_
|
691 | 697 | return true; |
692 | 698 | } |
693 | 699 | |
| 700 | bool DVBChannel::Tune_again(void) |
| 701 | { |
| 702 | return Tune(prev_channel, true); |
| 703 | } |
| 704 | |
694 | 705 | /** \fn DVBChannel::GetTuningParams(DVBTuning& tuning) const |
695 | 706 | * \brief Fetches DVBTuning params from driver |
696 | 707 | * \return true on success, false on failure |
diff -rup libmythtv.no_hack/dvbchannel.h libmythtv/dvbchannel.h
old
|
new
|
class DVBChannel : public QObject, publi
|
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; }; |
… |
… |
class DVBChannel : public QObject, publi
|
105 | 106 | dvb_frontend_info info; ///< Contains info on tuning hardware |
106 | 107 | dvb_channel_t chan_opts; ///< Tuning options sent to tuning hardware |
107 | 108 | DVBTuning prev_tuning; ///< Last tuning options sent to hardware |
| 109 | dvb_channel_t prev_channel; |
108 | 110 | |
109 | 111 | volatile int fd_frontend; ///< File descriptor for tuning hardware |
110 | 112 | int cardnum; ///< DVB Card number |
… |
… |
class DVBChannel : public QObject, publi
|
114 | 116 | bool first_tune; ///< Used to force hardware reset |
115 | 117 | |
116 | 118 | int nextcapchannel; ///< Signal an input change |
| 119 | int frequency_incr; |
117 | 120 | }; |
118 | 121 | |
119 | 122 | #endif |
diff -rup libmythtv.no_hack/dvbdiseqc.cpp libmythtv/dvbdiseqc.cpp
old
|
new
|
DVBDiSEqC::DVBDiSEqC(int _cardnum, int _
|
52 | 52 | { |
53 | 53 | |
54 | 54 | // Number of repeats for DiSEqC 1.1 devices |
55 | | repeat = 1; |
| 55 | repeat = 2; |
56 | 56 | } |
57 | 57 | |
58 | 58 | DVBDiSEqC::~DVBDiSEqC() |
Only in libmythtv: dvbdiseqc.cpp.rej
diff -rup libmythtv.no_hack/dvbrecorder.cpp libmythtv/dvbrecorder.cpp
old
|
new
|
DVBRecorder::DVBRecorder(TVRec *rec, DVB
|
127 | 127 | initDeCSA(); |
128 | 128 | // (end)softcsa-0.5.pre3 |
129 | 129 | |
| 130 | _has_payload = false; |
130 | 131 | } |
131 | 132 | |
132 | 133 | DVBRecorder::~DVBRecorder() |
… |
… |
bool DVBRecorder::ProcessTSPacket(const
|
880 | 881 | if (!info->payloadStartSeen) |
881 | 882 | { |
882 | 883 | if (!tspacket.PayloadStart()) |
| 884 | { |
| 885 | _has_payload = false; |
883 | 886 | return true; // not payload start - drop packet |
| 887 | } |
884 | 888 | |
885 | 889 | VERBOSE(VB_RECORD, |
886 | 890 | QString("PID 0x%1 Found Payload Start").arg(pid,0,16)); |
887 | 891 | info->payloadStartSeen = true; |
| 892 | _has_payload = true; |
888 | 893 | } |
889 | 894 | |
890 | 895 | // Write PAT & PMT tables occasionally |
diff -rup libmythtv.no_hack/dvbrecorder.h libmythtv/dvbrecorder.h
old
|
new
|
class DVBRecorder: public DTVRecorder, p
|
94 | 94 | bool IsOpen(void) const { return _stream_fd >= 0; } |
95 | 95 | void Close(void); |
96 | 96 | |
| 97 | bool HasPayload(void) const |
| 98 | { return _has_payload; } |
| 99 | |
97 | 100 | bool RecordsTransportStream(void) const |
98 | 101 | { return _record_transport_stream_option; } |
99 | 102 | |
… |
… |
class DVBRecorder: public DTVRecorder, p
|
165 | 168 | ProgramMapTable *_pmt; |
166 | 169 | uint _next_pmt_version; |
167 | 170 | int _ts_packets_until_psip_sync; |
| 171 | bool _has_payload; |
168 | 172 | |
169 | 173 | // Input Misc |
170 | 174 | /// PMT on input side |
Only in libmythtv: siparser.cpp.orig
Only in libmythtv: siparser.h.orig
Only in libmythtv: siparser.h.rej
diff -rup libmythtv.no_hack/tv_rec.cpp libmythtv/tv_rec.cpp
old
|
new
|
TVRec::TVRec(int capturecardnum)
|
130 | 130 | // RingBuffer info |
131 | 131 | ringBuffer(NULL), rbFilePrefix(""), rbFileExt("mpg") |
132 | 132 | { |
| 133 | // Retune stuff |
| 134 | retune_timer = new TuningTimer(); |
| 135 | retune_timer->setTimeout(10000); |
| 136 | retune_timer->start(); |
| 137 | retune_requests = 0; |
133 | 138 | } |
134 | 139 | |
135 | 140 | /** \fn TVRec::Init() |
… |
… |
void TVRec::RingBufferChanged(RingBuffer
|
3188 | 3193 | */ |
3189 | 3194 | void TVRec::HandleTuning(void) |
3190 | 3195 | { |
| 3196 | bool handle_done = false; |
| 3197 | |
3191 | 3198 | if (tuningRequests.size()) |
3192 | 3199 | { |
3193 | 3200 | const TuningRequest *request = &tuningRequests.front(); |
… |
… |
void TVRec::HandleTuning(void)
|
3199 | 3206 | kFlagEITScan|kFlagAntennaAdjust)) |
3200 | 3207 | { |
3201 | 3208 | if (!recorder) |
| 3209 | { |
3202 | 3210 | TuningFrequency(*request); |
| 3211 | retune_timer->restart(); |
| 3212 | retune_timer->addMSecs(1); |
| 3213 | retune_requests = 0; |
| 3214 | } |
3203 | 3215 | else |
3204 | 3216 | SetFlags(kFlagWaitingForRecPause); |
3205 | 3217 | } |
… |
… |
void TVRec::HandleTuning(void)
|
3221 | 3233 | GetDVBRecorder()->Close(); |
3222 | 3234 | GetDVBRecorder()->SetRingBuffer(NULL); |
3223 | 3235 | } |
| 3236 | |
| 3237 | retune_timer->restart(); |
| 3238 | retune_timer->addMSecs(1); |
| 3239 | retune_requests = 0; |
3224 | 3240 | #endif // USING_DVB |
3225 | 3241 | TuningFrequency(lastTuningRequest); |
3226 | 3242 | } |
3227 | | |
| 3243 | |
3228 | 3244 | if (HasFlags(kFlagWaitingForSignal)) |
3229 | 3245 | { |
3230 | 3246 | if (!TuningSignalCheck()) |
3231 | | return; |
| 3247 | handle_done = true; |
3232 | 3248 | } |
3233 | 3249 | |
3234 | 3250 | if (HasFlags(kFlagWaitingForSIParser)) |
3235 | 3251 | { |
3236 | 3252 | if (!TuningPMTCheck()) |
3237 | | return; |
| 3253 | handle_done = true; |
3238 | 3254 | } |
3239 | 3255 | |
| 3256 | #ifdef USING_DVB |
| 3257 | if (HasFlags(kFlagWaitingForSignal) || // Just because we have signal, we |
| 3258 | HasFlags(kFlagWaitingForSIParser)) // may not have the right transponder |
| 3259 | if (!retune_timer->elapsed() && (retune_requests < 30)) |
| 3260 | { |
| 3261 | RetuneChannel(); |
| 3262 | retune_requests++; |
| 3263 | } |
| 3264 | #endif // USING_DVB |
| 3265 | |
| 3266 | if (handle_done) |
| 3267 | return; |
| 3268 | |
3240 | 3269 | if (HasFlags(kFlagNeedToStartRecorder)) |
3241 | 3270 | { |
3242 | 3271 | if (recorder) |
… |
… |
void TVRec::HandleTuning(void)
|
3244 | 3273 | else |
3245 | 3274 | TuningNewRecorder(); |
3246 | 3275 | |
3247 | | // If we got this far it is safe to set a new starting channel... |
3248 | | if (channel) |
3249 | | channel->StoreInputChannels(); |
| 3276 | SetFlags(kFlagWaitingForPayload); |
| 3277 | } |
| 3278 | |
| 3279 | if (HasFlags(kFlagWaitingForPayload)) |
| 3280 | { |
| 3281 | #ifdef USING_DVB |
| 3282 | if (GetDVBRecorder()) |
| 3283 | { |
| 3284 | // Check to see if we have a Payload Start |
| 3285 | if (GetDVBRecorder()->HasPayload()) |
| 3286 | { |
| 3287 | ClearFlags(kFlagWaitingForPayload); |
| 3288 | |
| 3289 | // If we got this far it is safe to set a new starting channel... |
| 3290 | if (channel) |
| 3291 | channel->StoreInputChannels(); |
| 3292 | } |
| 3293 | } |
| 3294 | else |
| 3295 | { |
| 3296 | #endif // USING_DVB |
| 3297 | |
| 3298 | ClearFlags(kFlagWaitingForPayload); |
| 3299 | |
| 3300 | if (channel) |
| 3301 | channel->StoreInputChannels(); |
| 3302 | #if USING_DVB |
| 3303 | } |
| 3304 | #endif // USING_DVB |
3250 | 3305 | } |
3251 | 3306 | } |
3252 | 3307 | |
… |
… |
void TVRec::TuningShutdowns(const Tuning
|
3321 | 3376 | ClearFlags(kFlagPendingActions); |
3322 | 3377 | } |
3323 | 3378 | |
| 3379 | /** \fn TVRec::RetuneChannel(void) |
| 3380 | * \brief Retunes a DVB channel |
| 3381 | */ |
| 3382 | bool TVRec::RetuneChannel(void) |
| 3383 | { |
| 3384 | #ifdef USING_DVB |
| 3385 | if (GetDVBChannel()) |
| 3386 | return GetDVBChannel()->Tune_again(); |
| 3387 | #endif // USING_DVB |
| 3388 | return false; |
| 3389 | } |
| 3390 | |
3324 | 3391 | /** \fn TVRec::TuningFrequency(const TuningRequest&) |
3325 | 3392 | * \brief Performs initial tuning required for any tuning event. |
3326 | 3393 | * |
… |
… |
QString TVRec::FlagToString(uint f)
|
3880 | 3947 | msg += "WaitingForSignal,"; |
3881 | 3948 | if (kFlagWaitingForSIParser & f) |
3882 | 3949 | msg += "WaitingForSIParser,"; |
| 3950 | if (kFlagWaitingForPayload & f) |
| 3951 | msg += "kFlagWaitingForPayload,"; |
3883 | 3952 | if (kFlagNeedToStartRecorder & f) |
3884 | 3953 | msg += "NeedToStartRecorder,"; |
3885 | 3954 | if (kFlagKillRingBuffer & f) |
diff -rup libmythtv.no_hack/tv_rec.h libmythtv/tv_rec.h
old
|
new
|
|
13 | 13 | #include "mythdeque.h" |
14 | 14 | #include "programinfo.h" |
15 | 15 | #include "tv.h" |
| 16 | #include "util.h" |
16 | 17 | |
17 | 18 | class QSocket; |
18 | 19 | class NuppelVideoRecorder; |
… |
… |
class Channel;
|
37 | 38 | |
38 | 39 | class PMTObject; |
39 | 40 | |
| 41 | class TuningTimer |
| 42 | { |
| 43 | public: |
| 44 | TuningTimer() {} |
| 45 | |
| 46 | void setTimeout(long t) { _timeout = t; } |
| 47 | long timeout(void) { return _timeout; } |
| 48 | void start() { t_timer.start(); } |
| 49 | int restart() { int ret = elapsed(); |
| 50 | t_timer.restart(); |
| 51 | return ret; |
| 52 | } |
| 53 | int elapsed() { int ret = t_timer.elapsed(); |
| 54 | if (ret > _timeout) { ret = 0; t_timer.restart(); } |
| 55 | return ret; |
| 56 | } |
| 57 | |
| 58 | void addMSecs(int ms) { t_timer.addMSecs(ms); } |
| 59 | |
| 60 | private: |
| 61 | QTime t_timer; |
| 62 | long _timeout; |
| 63 | }; |
| 64 | |
40 | 65 | /// Used to request ProgramInfo for channel browsing. |
41 | 66 | typedef enum |
42 | 67 | { |
… |
… |
class TVRec : public QObject
|
276 | 301 | void TuningNewRecorder(void); |
277 | 302 | void TuningRestartRecorder(void); |
278 | 303 | |
| 304 | bool RetuneChannel(void); |
| 305 | |
279 | 306 | void HandleStateChange(void); |
280 | 307 | void ChangeState(TVState nextState); |
281 | 308 | bool StateIsRecording(TVState state); |
… |
… |
class TVRec : public QObject
|
362 | 389 | QString rbFilePrefix; |
363 | 390 | QString rbFileExt; |
364 | 391 | |
| 392 | // Retune stuff |
| 393 | TuningTimer *retune_timer; |
| 394 | int retune_requests; |
| 395 | |
365 | 396 | public: |
366 | 397 | static const uint kEITScanStartTimeout; |
367 | 398 | static const uint kSignalMonitoringRate; |
… |
… |
class TVRec : public QObject
|
394 | 425 | |
395 | 426 | static const uint kFlagNoRec = 0x0000F000; |
396 | 427 | static const uint kFlagKillRingBuffer = 0x00010000; |
| 428 | static const uint kFlagWaitingForPayload = 0x00020000; |
397 | 429 | |
398 | 430 | // Waiting stuff |
399 | 431 | static const uint kFlagWaitingForRecPause = 0x00100000; |