Ticket #743: find-correct-pat-in-400ms-v2.diff
File find-correct-pat-in-400ms-v2.diff, 3.3 KB (added by , 18 years ago) |
---|
-
libs/libmythtv/mpeg/mpegstreamdata.cpp
old new 24 24 _cached_pat(NULL), _desired_program(desiredProgram), 25 25 _pmt_single_program_num_video(1), 26 26 _pmt_single_program_num_audio(0), 27 _pat_single_program(NULL), _pmt_single_program(NULL) 27 _pat_single_program(NULL), _pmt_single_program(NULL), 28 _invalid_pat_seen(false) 28 29 { 29 30 AddListeningPID(MPEG_PAT_PID); 30 31 31 32 _pid_video_single_program = _pid_pmt_single_program = 0xffffffff; 33 34 connect(&_invalid_pat_timer, SIGNAL(timeout()), this, SLOT(ProcessInvalidPAT())); 32 35 } 33 36 34 37 MPEGStreamData::~MPEGStreamData() … … 46 49 void MPEGStreamData::Reset(int desiredProgram) 47 50 { 48 51 _desired_program = desiredProgram; 52 _invalid_pat_seen = false; 49 53 50 54 SetPATSingleProgram(0); 51 55 SetPMTSingleProgram(0); … … 406 410 407 411 void MPEGStreamData::ProcessPAT(const ProgramAssociationTable *pat) 408 412 { 409 emit UpdatePAT(pat); 410 if ((_desired_program >= 0) && CreatePATSingleProgram(*pat)) 411 emit UpdatePATSingleProgram(PATSingleProgram()); 413 bool foundProgram = pat->FindPID(_desired_program); 414 415 if (_desired_program < 0) 416 emit UpdatePAT(pat); 417 if (_desired_program >= 0) 418 { 419 if (!_invalid_pat_seen && !foundProgram) 420 { 421 _invalid_pat_seen = true; 422 _invalid_pat_timer.start(400, TRUE); // 400ms timeout. 423 VERBOSE(VB_IMPORTANT, "HandleTables -> PAT is missing program, setting timeout"); 424 } 425 else if (foundProgram) 426 { 427 if (_invalid_pat_seen) 428 { 429 _invalid_pat_seen = false; 430 _invalid_pat_timer.stop(); 431 VERBOSE(VB_IMPORTANT, "HandleTables -> PAT updated"); 432 } 433 emit UpdatePAT(pat); 434 if (CreatePATSingleProgram(*pat)) 435 emit UpdatePATSingleProgram(PATSingleProgram()); 436 } 437 } 412 438 } 413 439 414 440 void MPEGStreamData::ProcessPMT(const uint pid, const ProgramMapTable *pmt) … … 421 447 } 422 448 } 423 449 450 void MPEGStreamData::ProcessInvalidPAT(void) 451 { 452 VERBOSE(VB_IMPORTANT, "Program not found in PAT. Rescan your transports."); 453 } 454 424 455 #define DONE_WITH_PES_PACKET() { if (psip) delete psip; \ 425 456 if (morePSIPPackets) goto HAS_ANOTHER_PES; else return; } 426 457 -
libs/libmythtv/mpeg/mpegstreamdata.h
old new 7 7 using namespace std; 8 8 9 9 #include <qmap.h> 10 #include <qtimer.h> 10 11 #include "tspacket.h" 11 12 12 13 class ProgramAssociationTable; … … 179 180 uint _pmt_single_program_num_audio; 180 181 ProgramAssociationTable *_pat_single_program; 181 182 ProgramMapTable *_pmt_single_program; 183 184 // PAT Timeout handling. 185 protected slots: 186 void ProcessInvalidPAT(); 187 private: 188 bool _invalid_pat_seen; 189 QTimer _invalid_pat_timer; 182 190 }; 183 191 184 192 #include "mpegtables.h"