Ticket #1970: dvbrecorder_save_pidfilters.2.diff
File dvbrecorder_save_pidfilters.2.diff, 3.9 KB (added by , 18 years ago) |
---|
-
libs/libmythtv/dvbrecorder.cpp
old new void DVBRecorder::OpenFilter(uint pid, i 424 424 425 425 bool DVBRecorder::AdjustFilters(void) 426 426 { 427 _pmt_monitoring_pids.clear(); 427 428 StopDummyVideo(); // Stop the dummy video before acquiring the lock. 428 429 429 430 QMutexLocker change_lock(&_pid_lock); … … bool DVBRecorder::AdjustFilters(void) 437 438 add_stream_type.push_back(StreamID::PrivSec); 438 439 _stream_data->AddListeningPID(MPEG_PAT_PID); 439 440 440 for (uint i = 0; i < _input_pat->ProgramCount(); i++)441 {442 add_pid.push_back(_input_pat->ProgramPID(i));443 add_stream_type.push_back(StreamID::PrivSec);444 _stream_data->AddListeningPID(_input_pat->ProgramPID(i));445 }446 447 441 // Record the streams in the PMT... 448 442 bool need_pcr_pid = true; 449 443 for (uint i = 0; i < _input_pmt->StreamCount(); i++) … … bool DVBRecorder::AdjustFilters(void) 470 464 _stream_data->AddListeningPID(_eit_pids[i]); 471 465 } 472 466 467 for (uint i = 0; i < _input_pat->ProgramCount(); i++) 468 _pmt_monitoring_pids.push_back(_input_pat->ProgramPID(i)); 469 473 470 // Delete filters for pids we no longer wish to monitor 474 471 PIDInfoMap::iterator it = _pid_infos.begin(); 475 472 PIDInfoMap::iterator next = it; … … bool DVBRecorder::AdjustEITPIDs(void) 536 533 return true; 537 534 } 538 535 536 void DVBRecorder::AdjustMonitoringPMTPIDs() 537 { 538 if (_pmt_monitoring_pids.empty()) 539 return; 540 541 QMutexLocker change_lock(&_pid_lock); 542 543 while (!_pmt_listening_pids.empty()) 544 { 545 uint pid = _pmt_listening_pids.front(); 546 if (_pid_infos.contains(pid)) 547 { 548 _stream_data->RemoveListeningPID(pid); 549 _stream_data->RemoveWritingPID(pid); 550 _pid_infos[pid]->Close(); 551 delete _pid_infos[pid]; 552 _pid_infos.erase(pid); 553 } 554 _pmt_monitoring_pids.push_back(pid); 555 _pmt_listening_pids.pop_front(); 556 } 557 558 for (unsigned int i=0; i<5 && i<_pmt_monitoring_pids.size(); ++i) 559 { 560 uint pid = _pmt_monitoring_pids.front(); 561 OpenFilter(pid, DMX_PES_OTHER, StreamID::PrivSec); 562 _stream_data->AddListeningPID(pid); 563 _pmt_listening_pids.push_back(pid); 564 _pmt_monitoring_pids.pop_front(); 565 } 566 } 567 539 568 void DVBRecorder::StartRecording(void) 540 569 { 541 570 if (!Open()) … … void DVBRecorder::StartRecording(void) 565 594 } 566 595 _drb->Start(); 567 596 597 int count = 0; 568 598 while (_request_recording && !_error) 569 599 { 570 600 if (PauseAndWait()) … … void DVBRecorder::StartRecording(void) 602 632 } 603 633 } 604 634 635 if (count-- <= 0) 636 { 637 AdjustMonitoringPMTPIDs(); 638 count = 500; 639 } 640 605 641 ssize_t len = _drb->Read(_buffer, _buffer_size); 606 642 if (len > 0) 607 643 ProcessDataTS(_buffer, len); -
libs/libmythtv/dvbrecorder.h
old new 10 10 11 11 // C++ includes 12 12 #include <vector> 13 #include <deque> 13 14 using namespace std; 14 15 15 16 // Qt includes … … class DVBRecorder : public DTVRecorder, 91 92 92 93 bool AdjustFilters(void); 93 94 bool AdjustEITPIDs(void); 95 void AdjustMonitoringPMTPIDs(void); 94 96 void CloseFilters(void); 95 97 void OpenFilter(uint pid, int pes_type, uint mpeg_stream_type); 96 98 int OpenFilterFd(uint pid, int pes_type, uint stream_type); … … class DVBRecorder : public DTVRecorder, 132 134 PIDInfoMap _pid_infos; 133 135 uint_vec_t _eit_pids; 134 136 137 deque<uint> _pmt_monitoring_pids; 138 deque<uint> _pmt_listening_pids; 139 135 140 /// PAT on input side 136 141 ProgramAssociationTable *_input_pat; 137 142 /// PMT on input side